H.J. Lu [Thu, 11 Apr 2019 13:52:03 +0000 (06:52 -0700)]
ld: Add -static-pie tests
Add -static-pie tests for DT_INIT_ARRAY, DT_FINI_ARRAY, DT_PREINIT_ARRAY
and IFUNC.
* testsuite/config/default.exp (STATIC_PIE_LDFLAGS): New. Set
to "-static-pie" if target compiler supports it.
* testsuite/ld-elf/elf.exp: Run -static-pie tests if
$STATIC_PIE_LDFLAGS isn't empty.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
H.J. Lu [Thu, 11 Apr 2019 13:44:53 +0000 (06:44 -0700)]
Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry
Instead of BFD_ASSERT (h != NULL) with
ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562
ld: bad.o: invalid string offset
50331648 >= 371 for section `nterp'
check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with
ld: bad.o: section 'g': corrupt VTENTRY entry
* elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of
"h != NULL". Don't check "h != NULL" before calling.
bfd_elf_gc_record_vtentry.
* elf32-arm.c (elf32_arm_check_relocs): Likewise.
* elf32-bfin.c (bfin_check_relocs): Likewise.
* elf32-cris.c (cris_elf_check_relocs): Likewise.
* elf32-csky.c (csky_elf_check_relocs): Likewise.
* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
* elf32-frv.c (elf32_frv_check_relocs): Likewise.
* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
* elf32-metag.c (elf_metag_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
* elf32-s390.c (elf_s390_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Likewise.
* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_s390_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt
VTENTRY entry.
Alan Modra [Thu, 11 Apr 2019 10:12:31 +0000 (19:42 +0930)]
PR24435, buffer overflow reading dynamic entries
PR 24435
* elflink.c (elf_link_add_object_symbols): Don't read partial
dynamic entries from fuzzed objects.
Tamar Christina [Thu, 11 Apr 2019 10:27:28 +0000 (11:27 +0100)]
AArch64: When DF_BIND_NOW don't use TLSDESC GOT value.
When using DF_BIND_NOW on AArch64 we don't reserve the GOT slot for a TLSDESC,
but we still emitted DT_TLSDESC_GOT and DT_TLSDESC_PLT. This caused random
memory corruption as the "special" value of (bfd_vma)-1 would be set for
dt_tlsdesc_got.
Since we don't have a value of dt_tlsdesc_got I also don't emit DT_TLSDESC_PLT
now becuase it would point to an incomplete PLT. To be able to write the PLT
entry DT_TLSDESC_GOT is needed and since we don't have one we can't write the
PLT entry either.
It is my understanding that GLIBC doesn't need these two entries when not lazy
loading. Conversely AArch32 does not reserve neither the GOT not the PLT slot
when doing DF_BIND_NOW.
AArch32 does not need these checks because these values are initialized to 0
and so the if (...) checks don't pass, but on AArch64 these are initialized
to (bfd_vma)-1 and thus we need some extra checks.
bfd/ChangeLog:
PR ld/24302
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Don't emit
DT_TLSDESC_GOT and DT_TLSDESC_PLT when DF_BIND_NOW.
(elfNN_aarch64_finish_dynamic_sections): Don't write PLT if DF_BIND_NOW.
ld/ChangeLog:
PR ld/24302
* testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
* testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: New test.
Sudakshina Das [Thu, 11 Apr 2019 09:19:37 +0000 (10:19 +0100)]
[BINUTILS, AArch64, 2/2] Update Store Allocation Tag instructions
This patch updates the Store allocation tags instructions in
Armv8.5-A Memory Tagging Extension. This is part of the changes
that have been introduced recently in the 00bet10 release
All of these instructions have an updated register operand (Xt -> <Xt|SP>)
- STG <Xt|SP>, [<Xn|SP>, #<simm>]
- STG <Xt|SP>, [<Xn|SP>, #<simm>]!
- STG <Xt|SP>, [<Xn|SP>], #<simm>
- STZG <Xt|SP>, [<Xn|SP>, #<simm>]
- STZG <Xt|SP>, [<Xn|SP>, #<simm>]!
- STZG <Xt|SP>, [<Xn|SP>], #<simm>
- ST2G <Xt|SP>, [<Xn|SP>, #<simm>]
- ST2G <Xt|SP>, [<Xn|SP>, #<simm>]!
- ST2G <Xt|SP>, [<Xn|SP>], #<simm>
- STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]
- STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]!
- STZ2G <Xt|SP>, [<Xn|SP>], #<simm>
In order to accept <Rt|SP> a new operand type Rt_SP is introduced which has
the same field as FLD_Rt but follows other semantics of Rn_SP.
*** gas/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* config/tc-aarch64.c (process_omitted_operand): Add case for
AARCH64_OPND_Rt_SP.
(parse_operands): Likewise.
* testsuite/gas/aarch64/armv8_5-a-memtag.d: Update tests.
* testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise.
* testsuite/gas/aarch64/illegal-memtag.l: Likewise.
* testsuite/gas/aarch64/illegal-memtag.s: Likewise.
*** include/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_Rt_SP.
*** opcodes/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* aarch64-opc.c (aarch64_print_operand): Add case for
AARCH64_OPND_Rt_SP.
(verify_constraints): Likewise.
* aarch64-tbl.h (QL_LDST_AT): Update to add SP qualifier.
(struct aarch64_opcode): Update stg, stzg, st2g, stz2g instructions
to accept Rt|SP as first operand.
(AARCH64_OPERANDS): Add new Rt_SP.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
Sudakshina Das [Thu, 11 Apr 2019 09:13:23 +0000 (10:13 +0100)]
[BINUTILS, AArch64, 1/2] Add new LDGM/STGM instruction
This patch adds the new LDGM/STGM instructions of the
Armv8.5-A Memory Tagging Extension. This is part of the changes
that have been introduced recently in the 00bet10 release
The instructions are as follows:
LDGM Xt, [<Xn|SP>]
STGM Xt, [<Xn|SP>]
*** gas/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* testsuite/gas/aarch64/armv8_5-a-memtag.d: New tests for ldgm and stgm.
* testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise.
* testsuite/gas/aarch64/illegal-memtag.l: Likewise.
* testsuite/gas/aarch64/illegal-memtag.s: Likewise.
*** opcodes/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-tbl.h (aarch64_opcode): Add new ldgm and stgm.
Alan Hayward [Wed, 10 Apr 2019 14:58:27 +0000 (15:58 +0100)]
AArch64: Ensure regcache is reset between tests
A recent change made the AArch64 self tests resuse the saved regs
cache, rather than creating a new one. Ensure it is reset to default
values between tests.
Do this by splitting the reset functionality from trad_frame_alloc_saved_regs
into a new function.
Fixes selftest on AArch64.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_analyze_prologue_test): Reset saved regs.
* trad-frame.c (trad_frame_reset_saved_regs): New function.
(trad_frame_alloc_saved_regs): Call trad_frame_reset_saved_regs.
* trad-frame.h (trad_frame_reset_saved_regs): New declaration.
H.J. Lu [Thu, 11 Apr 2019 01:36:05 +0000 (18:36 -0700)]
ld: Don't define __rel[a]_iplt_start/__rel[a]_iplt_end in PIE
__rel[a]_iplt_start and __rel[a]_iplt_end are defined to handle IFUNC in
static executables. For PIE, since IFUNC is handled as the part of the
normal dynamic relocation processing, there is no need to define these
symbols in PIE.
* scripttempl/elf.sc (CREATE_PIC): New. Set for CREATE_SHLIB or
CREATE_PIE.
(__rel_iplt_start): Don't define for CREATE_PIC.
(__rel_iplt_end): Likewise.
(__rela_iplt_start): Likewise.
(__rela_iplt_end): Likewise.
Kevin Buettner [Sat, 16 Mar 2019 19:40:01 +0000 (12:40 -0700)]
Fix amd64->i386 linux syscall restart problem
This commit fixes some failures in gdb.base/interrupt.exp
when debugging a 32-bit i386 linux inferior from an amd64 host.
When running the following test...
make check RUNTESTFLAGS="--target_board unix/-m32 interrupt.exp"
... without this commit, I see the following output:
FAIL: gdb.base/interrupt.exp: continue (the program exited)
FAIL: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: Send Control-C, second time
FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running)
ERROR: Undefined command "".
ERROR: GDB process no longer exists
=== gdb Summary ===
When the test is run with this commit in place, we see 12 passes
instead. This is the desired behavior.
Analysis:
On Linux, when a syscall is interrupted by a signal, the syscall
may return -ERESTARTSYS when a signal occurs. Doing so indicates that
the syscall is restartable. Then, depending on settings associated
with the signal handler, and after the signal handler is called, the
kernel can then either return -EINTR or can cause the syscall to be
restarted. In this discussion, we are concerned with the latter
case.
On i386, the kernel returns this status via the EAX register.
When debugging a 32-bit (i386) process from a 64-bit (amd64)
GDB, the debugger fetches 64-bit registers even though the
process being debugged is 32-bit. Since we're debugging a 32-bit
target, only 32 bits are being saved in the register cache.
Now, ideally, GDB would save all 64-bits in the regcache and
then would be able to restore those same values when it comes
time to continue the target. I've looked into doing this, but
it's not easy and I don't see many benefits to doing so. One
benefit, however, would be that EAX would appear as a negative
value for doing syscall restarts.
At the moment, GDB is setting the high 32 bits of RAX (and other
registers too) to 0. So, when GDB restores EAX just prior to
a syscall restart, the high 32 bits of RAX are zeroed, thus making
it look like a positive value. For this particular purpose, we
need to sign extend EAX so that RAX will appear as a negative
value when EAX is set to -ERESTARTSYS. This in turn will cause
the signal handling code in the kernel to recognize -ERESTARTSYS
which will in turn cause the syscall to be restarted.
This commit is based on work by Jan Kratochvil from 2009:
https://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
Jan's patch had the sign extension code in amd64-nat.c. Several
other native targets make use of this code, so it seemed better
to move the sign extension code to a linux specific file. I
also added similar code to gdbserver.
Another approach is to fix the problem in the kernel. Hui Zhu
tried to get a fix into the kernel back in 2014, but it was not
accepted. Discussion regarding this approach may be found here:
https://lore.kernel.org/patchwork/patch/457841/
Even if a fix were to be put into the kernel, we'd still need
some kind of fix in GDB in order to support older kernels.
Finally, I'll note that Fedora has been carrying a similar patch for
at least nine years. Other distributions, including RHEL and CentOS
have picked up this change and have been using it too.
gdb/ChangeLog:
* amd64-linux-nat.c (amd64_linux_collect_native_gregset): New
function.
(fill_gregset): Call amd64_linux_collect_native_gregset instead
of amd64_collect_native_gregset.
(amd64_linux_nat_target::store_registers): Likewise.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
when using a 64-bit gdbserver.
GDB Administrator [Thu, 11 Apr 2019 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Wed, 10 Apr 2019 14:49:36 +0000 (15:49 +0100)]
Pull in patch for libiberty that fixes a stack exhaustion bug when demangling a pathalogically constructed mangled name.
PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter. Adjust
body of the function accordingly. Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.
Tom Tromey [Sun, 10 Mar 2019 21:37:20 +0000 (15:37 -0600)]
Introduce a separate debug objfile iterator
This introduces a new iterator and range adapter for iteration over
the separate debug files of a given objfile. As in the current
approach, the requested objfile is returned first, followed by the
separate debug objfiles.
gdb/ChangeLog
2019-04-10 Tom Tromey <tom@tromey.com>
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_in_objfile_from_linkage_name): Use the iterator.
* objfiles.h (class separate_debug_iterator): New.
(class separate_debug_range): New.
(struct objfile) <separate_debug_objfiles>: New method.
(objfile_separate_debug_iterate): Don't declare.
* objfiles.c (separate_debug_iterator::operator++): Rename from
objfile_separate_debug_iterate.
(objfile_relocate, objfile_rebase, objfile_has_symbols): Use the
iterator.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Use the
iterator.
Tom Tromey [Sun, 10 Mar 2019 21:01:26 +0000 (15:01 -0600)]
Fix a couple of comments
While working on objfiles I noticed a typo in one comment, and another
comment that, as far as I can tell, has been obsolete for a very long
time.
gdb/ChangeLog
2019-04-10 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Remove old comment.
* objfiles.c (free_all_objfiles): Fix a typo.
Tom Tromey [Sun, 20 Jan 2019 04:30:36 +0000 (21:30 -0700)]
Remove some uses of "object_files"
The "object_files" macro is sometimes used when iterating over
objfiles. This patch removes a few such uses in favor of the new
range adapter.
gdb/ChangeLog
2019-04-10 Tom Tromey <tom@tromey.com>
* ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
* minsyms.c (lookup_minimal_symbol): Use foreach.
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline): Likewise.
* symfile.c (reread_symbols): Use foreach.
Michael Forney [Wed, 10 Apr 2019 08:47:37 +0000 (18:17 +0930)]
PR24427, bfd/doc/chew.c reads uninitialized memory and subtracts from function pointer
PR 24427
* doc/chew.c (free_words): Correctly free "push_text" strings.
Rainer Orth [Wed, 10 Apr 2019 07:48:43 +0000 (09:48 +0200)]
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86
The fix H.J. implemented for PR gas/22791 in the thread starting at
[PATCH] x86-64: Treat PC32 relocation with branch as PLT32
https://sourceware.org/ml/binutils/2018-02/msg00065.html
is causing problems on Solaris/x86. The native linker is strongly
preferred there, and there's no intention of implementing the linker
optimization he plans there. Besides, the kernel runtime linker,
otherwise has no need to deal with that reloc at all, and instead of
adding (possibly even more) workarounds with no benefit, it seems
appropriate to disable the R_X86_64_PLT32 generation as branch marker on
Solaris/x86 in the first place.
The patch itself is trivial, the only complication is adapting the
testsuite. Since I've found no way to have conditional sections in the
.d files, I've instead used the solution already found elsewhere of
having separate .d files for the affected tests in an i386/solaris
subdirectory and skipping the original ones.
Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without
regressions.
* config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.
* testsuite/gas/i386/solaris/solaris.exp: New driver.
* testsuite/gas/i386/solaris/reloc64.d,
testsuite/gas/i386/solaris/x86-64-jump.d,
testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d,
testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d,
testsuite/gas/i386/solaris/x86-64-nop-3.d,
testsuite/gas/i386/solaris/x86-64-nop-4.d,
testsuite/gas/i386/solaris/x86-64-nop-5.d,
testsuite/gas/i386/solaris/x86-64-relax-2.d,
testsuite/gas/i386/solaris/x86-64-relax-3.d: New tests.
* testsuite/gas/i386/reloc64.d,
testsuite/gas/i386/x86-64-jump.d,
testsuite/gas/i386/x86-64-mpx-branch-1.d,
testsuite/gas/i386/x86-64-mpx-branch-2.d,
testsuite/gas/i386/x86-64-nop-3.d,
testsuite/gas/i386/x86-64-nop-4.d,
testsuite/gas/i386/x86-64-nop-5.d,
testsuite/gas/i386/x86-64-relax-2.d,
testsuite/gas/i386/x86-64-relax-3.d: Skip on *-*-solaris*.
Alan Modra [Wed, 10 Apr 2019 06:00:37 +0000 (15:30 +0930)]
Re: XFAIL PR ld/20995 tests for lynxos and nto targets
* testsuite/ld-elf/shared.exp: Don't xfail PR ld/20995 for
powerpc-nto.
Alan Modra [Wed, 10 Apr 2019 02:28:15 +0000 (11:58 +0930)]
cskyelf.em branch stub handling
This fixes the csky-elf ld-elf/pr21884 and ld-unique/pr21529 failures,
by disabling branch stubs for binary (and other non-csky) output.
The csky-linux target gets branch stubs off by default because
presumably there are reasons why branch stubs were disabled, but
rather than killing the support completely it can be enabled by
--branch-stub.
* emultempl/cskyelf.em (csk_elf_before_parse): New function,
setting use_branch_stub false for linux.
(csky_elf_create_output_section_statements): Do emit this
function and all others in the file for linux, plus the branch
option control. Disable branch stubs when non-ELF.
Alan Modra [Wed, 10 Apr 2019 02:05:48 +0000 (11:35 +0930)]
Fix some ld dependencies
In looking at the csky-elf vs. csky-linux differences, the first thing
I compared was csky_elf.sh and cskyelf_linux.sh. Those files are
mostly the same but besides the real differences, annoyingly have some
lines ordered differently. It's better in such cases to have one file
source the other, making differences plain. This patch does that for
csky and microblaze, removes an unused variable defined in a few
places, and fixes ld makefile dependencies.
* Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em.
(ecskyelf_linux.c): Depend on cskyelf.sh.
(eelf32microblazeel.c): Depend on elf32microblaze.sh.
* Makefile.in: Regenerate.
* emulparams/cskyelf.sh: Comment regarding cskelf_linux.sh.
(PAGE_SIZE): Don't define.
* emulparams/cskyelf_linux.sh: Source sckyelf.sh, leaving just
the differing variable defs/undefs.
* emulparams/elf32mcore.sh (PAGE_SIZE): Don't define.
* emulparams/elf32microblaze.sh: Comment re. elf32microblazeel.sh.
(OUTPUT_FORMAT): Use BIG_OUTPUT_FORMAT.
(PAGE_SIZE): Don't define.
* emulparams/elf32microblazeel.sh: Source elf32microblaze.sh,
leaving just the differing OUTPUT_FORMAT.
Alan Modra [Wed, 10 Apr 2019 02:27:00 +0000 (11:57 +0930)]
Regen BLD-POTFILES.in
* po/BLD-POTFILES.in: Regenerate.
Alan Modra [Mon, 8 Apr 2019 07:27:51 +0000 (16:57 +0930)]
te-cloudabi.h
This patch is aimed a fixing large numbers of x86_64-cloudabi failures
caused by gas selecting the wrong target name.
* config/te-cloudabi.h: New file.
* config/tc-aarch64.c (aarch64_after_parse_args): Use TE_CLOUDABI
rather than TARGET_OS to select cloudabi.
* config/tc-i386.h (ELF_TARGET_FORMAT64): Define for TE_CLOUDABI.
* configure.tgt (*-*-cloudabi*): Set em=cloudabi.
GDB Administrator [Wed, 10 Apr 2019 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 9 Apr 2019 19:19:28 +0000 (13:19 -0600)]
Fix Rust lexer buglet
PR rust/24414 points out that the Rust lexer uses strtoul when lexing
an integer, and that this can give the wrong results in some
situations.
This patch changes it to use strtoulst, like most of the rest of gdb.
It also adds a self test.
Tested on x86-64 Fedora 29 using an i686 build.
gdb/ChangeLog
2019-04-09 Ivan Begert <ivanbegert@gmail.com>
Tom Tromey <tromey@adacore.com>
PR rust/24414:
* rust-exp.y (rust_parser::lex_number): Use strtoulst.
(rust_lex_int_test): Change "value" to be LONGEST.
(rust_lex_tests): Add test for long integer literal.
Tom Tromey [Thu, 4 Apr 2019 22:57:11 +0000 (16:57 -0600)]
Use find_thread_in_random in select_event_lwp
I noticed that find_thread_in_random duplicates the code in
find_thread_in_random, so this patch changes the latter to use the
former.
There are two other spots in gdb that do this, but to unify all of
them would require switching some code from using the "iterate over"
idiom to using iterators.
Another possible improvement is that find_thread_in_random could be
made single-pass using reservoir sampling.
Tested by the buildbot.
gdb/gdbserver/ChangeLog
2019-04-09 Tom Tromey <tromey@adacore.com>
* linux-low.c (select_event_lwp): Use find_thread_in_random.
Tom Tromey [Thu, 4 Apr 2019 23:03:27 +0000 (17:03 -0600)]
Consistently use bool for fake_pid_p
I noticed a few spots where fake_pid_p is handled as an int, whereas
the field in struct inferior has type bool. This patch changes the
remaining places to use bool as well.
Tested by the buildbot.
gdb/ChangeLog
2019-04-09 Tom Tromey <tromey@adacore.com>
* remote.c (remote_target::remote_add_inferior): Change fake_pid_p
to bool.
(extended_remote_target::attach): Update.
(remote_target::remote_notice_new_inferior): Update.
(remote_target::add_current_inferior_and_thread): Update.
* inferior.c (exit_inferior_1): Use "false".
* corelow.c (add_to_thread_list): Make fake_pid_p bool.
Simon Marchi [Tue, 9 Apr 2019 16:35:29 +0000 (12:35 -0400)]
Fix typo in latest ChangeLog entry
Simon Marchi [Tue, 9 Apr 2019 16:32:26 +0000 (12:32 -0400)]
Use -qualified flag when setting temporary breakpoint in start command
When using the "start" command, GDB puts a temporary breakpoint on the
"main" symbol (we literally invoke the tbreak command). However, since
it does wild matching by default, it also puts a breakpoint on any C++
method or "main" function in a namespace. For example, when debugging
GDB, it creates a total of 24 locations:
(gdb) start
Temporary breakpoint 1 at 0x198c1e9: main. (24 locations)
as there are a bunch of methods called main in the selftests, such as
selftests::string_view::capacity_1::main()
If such method was called in the constructor of a global object, or a
function marked with the attribute "constructor", then we would stop at
the wrong place. Also, this causes a few extra symtabs (those that
contain the "wrong" mains) to be expanded for nothing.
The dummiest, most straightforward solution is to add -qualified when
invoking tbreak. With this patch, "start" creates a single-location
breakpoint, as expected.
I copied the start.exp test to start-cpp.exp and made it use a C++ test
file, which contains two main functions. The new test verifies that the
output of "start" is the output we get when we set a single-location
breakpoint.
gdb/ChangeLog:
* infcmd.c (run_command_1): Pass -qualified to tbreak when usind
the "start" command.
gdb/testsuite/ChangeLog:
* gdb.base/start-cpp.exp: New file.
* gdb.base/start-cpp.cc: New file.
Robert Suchanek [Tue, 9 Apr 2019 09:30:26 +0000 (17:30 +0800)]
[MIPS] Add RDHWR with the SEL field for MIPS R6.
In Release 6 of the MIPS architecture [1], instruction RDHWR supports
a 3rd operand to serve as the 3-bit select field for the hardware
register.
[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 332-334
opcodes/
* mips-opc.c (mips_builtin_opcodes): Add RDHWR rt rd sel.
gas/
* testsuite/gas/mips/mips.exp: Run hwr-names test.
* testsuite/gas/mips/hwr-names.s: Add test cases for RDHWR with
the SEL field.
* testsuite/gas/mips/mipsr6@hwr-names.d: New file.
Kevin Buettner [Thu, 21 Mar 2019 03:38:33 +0000 (20:38 -0700)]
Rename python function thread_from_thread_handle to thread_from_handle
This renaming was done to stay consistent with the naming of the new
gdb.InferiorThread.handle method. I had initially named it "thread_handle"
but Tom Tromey suggested just "handle".
The old name (thread_from_thread_handle) still works, but is marked as
deprecated in comments in the code as well as in the documentation.
I have some code which uses these functions. I very much like the
brevity of the new names.
gdb/doc/ChangeLog:
* python.texi (Inferiors In Python): Rename
Inferior.thread_from_thread_handle to Inferior.thread_from_handle.
Add note about the former being deprecated.
gdb/ChangeLog:
* python/py-inferior.c (infpy_thread_from_thread_handle):
Adjust comments to reflect renaming of thread_from_thread_handle
to thread_from_handle. Adjust keywords. Fix type error message.
(inferior_object_methods): Add thread_from_handle. Retain
thread_from_thread_handle, but mark it as deprecated.
testsuite/ChangeLog:
* gdb.python/py-thrhandle.exp: Adjust tests to call
thread_from_handle instead of thread_from_thread_handle.
Kevin Buettner [Sun, 16 Sep 2018 04:53:38 +0000 (21:53 -0700)]
Documentation for python method InferiorThread.handle
gdb/doc/ChangeLog:
* python.texi (Threads In Python): Add description for method
InferiorThread.handle.
Kevin Buettner [Sun, 16 Sep 2018 04:15:49 +0000 (21:15 -0700)]
Tests for gdb.InferiorThread.handle
gdb/testsuite/ChangeLog:
* gdb.python/py-thrhandle.exp: Add tests for
gdb.InferiorThread.handle.
Kevin Buettner [Wed, 27 Feb 2019 22:06:28 +0000 (15:06 -0700)]
Support buffer objects as handles in Inferior.thread_from_thread_handle()
InferiorThread.handle() returns a python bytes object. We'd like to
be able to pass the output of this function, a thread handle, to
Inferior.thread_from_thread_handle(). Up to now,
thread_from_thread_handle() expects to receive a gdb.Value input.
This commit adds support to also allow a python buffer object to be
passed as the handle.
infpy_thread_from_thread_handle() calls find_thread_by_handle() which
has the obvious functionality. It used to pass the thread handle via
a struct value pointer. I've revised this interface to instead pass a
gdb::array_view<const gdb_byte> object. (Thanks to Tom Tromey for
suggesting this data structure over an earlier version which passed a
gdb_byte pointer and length.)
gdb/ChangeLog:
* gdbthread.h (find_thread_by_handle): Revise declaration.
* thread.c (find_thread_by_handle): Likewise. Adjust
implementation too.
* python/py-inferior.c (infpy_thread_from_thread_handle): Add
support for buffer objects as handles.
Kevin Buettner [Wed, 27 Feb 2019 21:59:02 +0000 (14:59 -0700)]
Add python method InferiorThread.handle
gdb/ChangeLog:
* python/py-infthread.c (thpy_thread_handle): New function.
(thread_object_methods): Register thpy_thread_handle.
Kevin Buettner [Fri, 8 Feb 2019 02:16:04 +0000 (19:16 -0700)]
Introduce target_ops method thread_info_to_thread_handle
This patch adds a thread_info_to_thread_handle method to the target_ops
struct. It also implements this functionality for remote targets and
linux native threads.
gdb/ChangeLog:
* gdbthread.h (thread_to_thread_handle): Declare.
* thread.c (gdbtypes.h): Include.
(thread_to_thread_handle): New function.
* target.h (struct target_ops): Add thread_info_to_thread_handle.
(target_thread_info_to_thread_handle): Declare.
* target.c (target_thread_info_to_thread_handle): New function.
* target-debug.h (target_debug_print_gdb_byte_vector): Define.
* target-delegates.c: Regenerate.
* linux-thread-db.c (class thread_db_target): Add method
thread_info_to_thread_handle.
(thread_db_target::thread_info_to_thread_handle): Define.
* remote.c (class remote_target): Add new method
thread_info_to_thread_handle.
(remote_target::thread_info_to_thread_handle): Define.
H.J. Lu [Tue, 9 Apr 2019 00:04:01 +0000 (17:04 -0700)]
x86: Define GNU_PROPERTY_X86_ISA_1_AVX512_BF16
Update assembler and readelf to support
#define GNU_PROPERTY_X86_ISA_1_AVX512_BF16 (1U << 24)
for AVX512_BF16.
binutils/
* readelf.c (decode_x86_isa): Handle
GNU_PROPERTY_X86_ISA_1_AVX512_BF16.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
gas/
* config/tc-i386.c (output_insn): Support
GNU_PROPERTY_X86_ISA_1_AVX512_BF16.
* testsuite/gas/i386/property-2.s: Add AVX512_BF16 test.
* testsuite/gas/i386/property-2.d: Updated.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.
include/
* elf/common.h (GNU_PROPERTY_X86_ISA_1_AVX512_BF16): New.
GDB Administrator [Tue, 9 Apr 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 8 Apr 2019 20:54:20 +0000 (13:54 -0700)]
XFAIL PR ld/20995 tests for lynxos and nto targets
lynxos and nto targets don't support RELRO.
* testsuite/ld-elf/shared.exp: XFAIL PR ld/20995 tests for
lynxos and nto targets.
Pedro Alves [Mon, 8 Apr 2019 12:03:54 +0000 (13:03 +0100)]
Some gdb_exception{,error,quit} tweaks
- Explicitly include <string> for std::string.
- Use std::make_shared to construct gdb_exception::message instead of
operator new, avoiding one heap allocation (2 instead of 3). Add
'const char *fmt, va_list ap' parameters to
gdb_exception{,error,quit}'s ctors, and do the std::make_shared in
the gdb_exception ctor.
- gdb_exception_error's constructor does not need to have an 'enum
return_reason' parameter, since it is always RETURN_ERROR, by
definition.
- Similarly, gdb_exception_quit's contructor does not need to have
'enum return_reason'/'enum errors' parameters.
- In the gdb_exception_{quit,_error} ctors that take a gdb_exception
as argument, assert that they're being passed a gdb_exception object
of the right 'reason'.
gdb/ChangeLog:
2019-04-08 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (throw_exception): Don't create
named object to throw; throw directly.
(throw_it): Likewise. Don't initialize gdb_exception::message
here, with new; pass FMT and AP to the ctor instead.
* common/common-exceptions.h: Include <string>.
(gdb_exception::gdb_exception(enum return_reason, enum errors,
const char *, va_list)): New ctor. Use std::make_shared.
(gdb_exception_error::gdb_exception_error(enum return_reason, enum
errors)): Delete.
(gdb_exception_error::gdb_exception_error(enum errors, const char
*, va_list)): New.
(gdb_exception_error::gdb_exception_error(const gdb_exception &)):
Add assertion.
(gdb_exception_quit::gdb_exception_quit(enum return_reason, enum
errors)): Delete.
(gdb_exception_quit::gdb_exception_quit(const char *, va_list)): New.
(gdb_exception_quit::gdb_exception_quit(const gdb_exception &)):
Add assertion.
H.J. Lu [Mon, 8 Apr 2019 18:58:51 +0000 (11:58 -0700)]
x86: Remove i386-*-kaos* and i386-*-chaos targets
Remove i386-*-kaos* and i386-*-chaos targets since they are no longer
supported by config.sub:
$ .../config.sub i386-kaos
Invalid configuration `i386-kaos': system `kaos' not recognized
$ .../config.sub i386-chaos
Invalid configuration `i386-chaos': system `chaos' not recognized
$
bfd/
* config.bfd: Remove i[3-7]86-*-kaos* and i[3-7]86-*-chaos targets.
gas/
* configure.tgt: Remove i386-*-kaos* and i386-*-chaos targets.
* testsuite/gas/i386/i386.exp: Remove *-*-caos* and "*-*-kaos*
check.
ld/
* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_chaos.c.
(eelf_i386_chaos.c): Removed.
* Makefile.in: Regenerated.
* configure.tgt: Remove i[3-7]86-*-kaos*.
* emulparams/elf_i386_chaos.sh: Removed.
H.J. Lu [Mon, 8 Apr 2019 18:34:32 +0000 (11:34 -0700)]
Count i386-moss as ELF
* testsuite/binutils-all/nm.exp: Count i386-moss as ELF.
H.J. Lu [Mon, 8 Apr 2019 18:27:57 +0000 (11:27 -0700)]
Use elf-x86.em for i386-moss and i386-beos
* emulparams/elf_i386_be.sh (EXTRA_EM_FILE): New.
* emulparams/i386moss.sh (EXTRA_EM_FILE): Likewise.
H.J. Lu [Mon, 8 Apr 2019 18:06:04 +0000 (11:06 -0700)]
x86: Consolidate AVX512 BF16 entries in i386-opc.tbl
1. Use single entry for vcvtne2ps2bf16 and vdpbf16ps with Disp8ShiftVL.
2. Use 5 entries, instead of 8, for vcvtneps2bf16.
* i386-opc.tbl: Consolidate AVX512 BF16 entries.
* i386-init.h: Regenerated.
Tom Tromey [Mon, 28 Jan 2019 17:45:45 +0000 (10:45 -0700)]
Replace throw_exception with throw in some cases
This replaces throw_exception with "throw;" when possible. This was
written by script. The rule that is followed is that uses of the
form:
catch (... &name)
{
...
throw_exception (name);
}
... can be rewritten. This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* valops.c (value_rtti_indirect_type): Replace throw_exception
with throw.
* tracefile-tfile.c (tfile_target_open): Replace throw_exception
with throw.
* thread.c (thr_try_catch_cmd): Replace throw_exception with
throw.
* target.c (target_translate_tls_address): Replace throw_exception
with throw.
* stack.c (frame_apply_command_count): Replace throw_exception
with throw.
* solib-spu.c (append_ocl_sos): Replace throw_exception with
throw.
* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
with throw.
* rs6000-tdep.c (rs6000_frame_cache)
(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
* remote.c: Replace throw_exception with throw.
* record-full.c (record_full_message, record_full_wait_1)
(record_full_restore): Replace throw_exception with throw.
* record-btrace.c:
(get_thread_current_frame_id, record_btrace_start_replaying)
(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
(cmd_record_btrace_start): Replace throw_exception with throw.
* parse.c (parse_exp_in_context_1): Replace throw_exception with
throw.
* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
(resume_stopped_resumed_lwps): Replace throw_exception with throw.
* linespec.c:
(find_linespec_symbols): Replace throw_exception with throw.
* infrun.c (displaced_step_prepare, resume): Replace
throw_exception with throw.
* infcmd.c (post_create_inferior): Replace throw_exception with
throw.
* inf-loop.c (inferior_event_handler): Replace throw_exception
with throw.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Replace throw_exception with throw.
* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
(get_prev_frame_always, get_frame_pc_if_available)
(get_frame_address_in_block_if_available, get_frame_language):
Replace throw_exception with throw.
* frame-unwind.c (frame_unwind_try_unwinder): Replace
throw_exception with throw.
* eval.c (fetch_subexp_value, evaluate_var_value)
(evaluate_funcall, evaluate_subexp_standard): Replace
throw_exception with throw.
* dwarf2loc.c (call_site_find_chain)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
Replace throw_exception with throw.
* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
with throw.
* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
throw.
* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
* completer.c (complete_line_internal): Replace throw_exception
with throw.
* compile/compile-object-run.c (compile_object_run): Replace
throw_exception with throw.
* cli/cli-script.c (process_next_line): Replace throw_exception
with throw.
* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
(btrace_enable, btrace_maint_update_pt_packets): Replace
throw_exception with throw.
* breakpoint.c (create_breakpoint, save_breakpoints): Replace
throw_exception with throw.
* break-catch-throw.c (re_set_exception_catchpoint): Replace
throw_exception with throw.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Replace throw_exception with throw.
* aarch64-tdep.c (aarch64_make_prologue_cache)
(aarch64_make_stub_cache): Replace throw_exception with throw.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
throw.
(linux_resume_one_lwp): Likewise.
Tom Tromey [Mon, 28 Jan 2019 17:56:58 +0000 (10:56 -0700)]
Make exception throwing a bit more efficient
This makes exception throwing a bit more efficient, by removing some
copies.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* common/common-exceptions.c (throw_exception): Rename from
throw_exception_cxx. Remove old copy. Make argument const.
(throw_it): Create and throw exception objects directly.
* common/common-exceptions.h (throw_exception): Make argument
const.
(struct gdb_exception_error): Add constructor.
(struct gdb_exception_quit): Add constructor.
Tom Tromey [Mon, 28 Jan 2019 17:29:42 +0000 (10:29 -0700)]
Remove some now-dead exception code
After the rewriting to use try/catch, some of the exception code is
now unused. This patch removes that code.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* common/common-exceptions.h (exception_rethrow): Don't declare.
(TRY_SJLJ): Update comment.
(TRY, CATCH, END_CATCH): Remove.
* common/common-exceptions.c (exception_rethrow): Remove.
Tom Tromey [Wed, 3 Apr 2019 21:59:07 +0000 (15:59 -0600)]
Rename gdb exception types
This renames the gdb exception types. The old types were only needed
due to the macros in common-exception.h that are now gone.
The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem
needed, so this patch removes it entirely.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL):
Remove.
(gdb_exception_error): Rename from
gdb_exception_RETURN_MASK_ERROR.
(gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT.
(gdb_quit_bad_alloc): Update.
* aarch64-tdep.c: Update.
* ada-lang.c: Update.
* ada-typeprint.c: Update.
* ada-valprint.c: Update.
* amd64-tdep.c: Update.
* arch-utils.c: Update.
* break-catch-throw.c: Update.
* breakpoint.c: Update.
* btrace.c: Update.
* c-varobj.c: Update.
* cli/cli-cmds.c: Update.
* cli/cli-interp.c: Update.
* cli/cli-script.c: Update.
* common/common-exceptions.c: Update.
* common/new-op.c: Update.
* common/selftest.c: Update.
* compile/compile-c-symbols.c: Update.
* compile/compile-cplus-symbols.c: Update.
* compile/compile-object-load.c: Update.
* compile/compile-object-run.c: Update.
* completer.c: Update.
* corelow.c: Update.
* cp-abi.c: Update.
* cp-support.c: Update.
* cp-valprint.c: Update.
* darwin-nat.c: Update.
* disasm-selftests.c: Update.
* dtrace-probe.c: Update.
* dwarf-index-cache.c: Update.
* dwarf-index-write.c: Update.
* dwarf2-frame-tailcall.c: Update.
* dwarf2-frame.c: Update.
* dwarf2loc.c: Update.
* dwarf2read.c: Update.
* eval.c: Update.
* event-loop.c: Update.
* event-top.c: Update.
* exec.c: Update.
* f-valprint.c: Update.
* fbsd-tdep.c: Update.
* frame-unwind.c: Update.
* frame.c: Update.
* gdbtypes.c: Update.
* gnu-v3-abi.c: Update.
* guile/guile-internal.h: Update.
* guile/scm-block.c: Update.
* guile/scm-breakpoint.c: Update.
* guile/scm-cmd.c: Update.
* guile/scm-disasm.c: Update.
* guile/scm-frame.c: Update.
* guile/scm-lazy-string.c: Update.
* guile/scm-math.c: Update.
* guile/scm-param.c: Update.
* guile/scm-ports.c: Update.
* guile/scm-pretty-print.c: Update.
* guile/scm-symbol.c: Update.
* guile/scm-symtab.c: Update.
* guile/scm-type.c: Update.
* guile/scm-value.c: Update.
* i386-linux-tdep.c: Update.
* i386-tdep.c: Update.
* inf-loop.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* jit.c: Update.
* language.c: Update.
* linespec.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* main.c: Update.
* mi/mi-cmd-break.c: Update.
* mi/mi-cmd-stack.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* objc-lang.c: Update.
* p-valprint.c: Update.
* parse.c: Update.
* ppc-linux-tdep.c: Update.
* printcmd.c: Update.
* python/py-arch.c: Update.
* python/py-breakpoint.c: Update.
* python/py-cmd.c: Update.
* python/py-finishbreakpoint.c: Update.
* python/py-frame.c: Update.
* python/py-framefilter.c: Update.
* python/py-gdb-readline.c: Update.
* python/py-inferior.c: Update.
* python/py-infthread.c: Update.
* python/py-lazy-string.c: Update.
* python/py-linetable.c: Update.
* python/py-objfile.c: Update.
* python/py-param.c: Update.
* python/py-prettyprint.c: Update.
* python/py-progspace.c: Update.
* python/py-record-btrace.c: Update.
* python/py-record.c: Update.
* python/py-symbol.c: Update.
* python/py-type.c: Update.
* python/py-unwind.c: Update.
* python/py-utils.c: Update.
* python/py-value.c: Update.
* python/python.c: Update.
* record-btrace.c: Update.
* record-full.c: Update.
* remote-fileio.c: Update.
* remote.c: Update.
* riscv-tdep.c: Update.
* rs6000-aix-tdep.c: Update.
* rs6000-tdep.c: Update.
* rust-exp.y: Update.
* rust-lang.c: Update.
* s390-tdep.c: Update.
* selftest-arch.c: Update.
* solib-dsbt.c: Update.
* solib-frv.c: Update.
* solib-spu.c: Update.
* solib-svr4.c: Update.
* solib.c: Update.
* sparc64-linux-tdep.c: Update.
* stack.c: Update.
* symfile-mem.c: Update.
* symmisc.c: Update.
* target.c: Update.
* thread.c: Update.
* top.c: Update.
* tracefile-tfile.c: Update.
* tui/tui.c: Update.
* typeprint.c: Update.
* unittests/cli-utils-selftests.c: Update.
* unittests/parse-connection-spec-selftests.c: Update.
* valops.c: Update.
* valprint.c: Update.
* value.c: Update.
* varobj.c: Update.
* windows-nat.c: Update.
* x86-linux-nat.c: Update.
* xml-support.c: Update.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* gdbreplay.c: Update.
* linux-low.c: Update.
* server.c: Update.
Tom Tromey [Wed, 3 Apr 2019 22:02:42 +0000 (16:02 -0600)]
Rewrite TRY/CATCH
This rewrites gdb's TRY/CATCH to plain C++ try/catch. The patch was
largely written by script, though one change (to a comment in
common-exceptions.h) was reverted by hand.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* xml-support.c: Use C++ exception handling.
* x86-linux-nat.c: Use C++ exception handling.
* windows-nat.c: Use C++ exception handling.
* varobj.c: Use C++ exception handling.
* value.c: Use C++ exception handling.
* valprint.c: Use C++ exception handling.
* valops.c: Use C++ exception handling.
* unittests/parse-connection-spec-selftests.c: Use C++ exception
handling.
* unittests/cli-utils-selftests.c: Use C++ exception handling.
* typeprint.c: Use C++ exception handling.
* tui/tui.c: Use C++ exception handling.
* tracefile-tfile.c: Use C++ exception handling.
* top.c: Use C++ exception handling.
* thread.c: Use C++ exception handling.
* target.c: Use C++ exception handling.
* symmisc.c: Use C++ exception handling.
* symfile-mem.c: Use C++ exception handling.
* stack.c: Use C++ exception handling.
* sparc64-linux-tdep.c: Use C++ exception handling.
* solib.c: Use C++ exception handling.
* solib-svr4.c: Use C++ exception handling.
* solib-spu.c: Use C++ exception handling.
* solib-frv.c: Use C++ exception handling.
* solib-dsbt.c: Use C++ exception handling.
* selftest-arch.c: Use C++ exception handling.
* s390-tdep.c: Use C++ exception handling.
* rust-lang.c: Use C++ exception handling.
* rust-exp.y: Use C++ exception handling.
* rs6000-tdep.c: Use C++ exception handling.
* rs6000-aix-tdep.c: Use C++ exception handling.
* riscv-tdep.c: Use C++ exception handling.
* remote.c: Use C++ exception handling.
* remote-fileio.c: Use C++ exception handling.
* record-full.c: Use C++ exception handling.
* record-btrace.c: Use C++ exception handling.
* python/python.c: Use C++ exception handling.
* python/py-value.c: Use C++ exception handling.
* python/py-utils.c: Use C++ exception handling.
* python/py-unwind.c: Use C++ exception handling.
* python/py-type.c: Use C++ exception handling.
* python/py-symbol.c: Use C++ exception handling.
* python/py-record.c: Use C++ exception handling.
* python/py-record-btrace.c: Use C++ exception handling.
* python/py-progspace.c: Use C++ exception handling.
* python/py-prettyprint.c: Use C++ exception handling.
* python/py-param.c: Use C++ exception handling.
* python/py-objfile.c: Use C++ exception handling.
* python/py-linetable.c: Use C++ exception handling.
* python/py-lazy-string.c: Use C++ exception handling.
* python/py-infthread.c: Use C++ exception handling.
* python/py-inferior.c: Use C++ exception handling.
* python/py-gdb-readline.c: Use C++ exception handling.
* python/py-framefilter.c: Use C++ exception handling.
* python/py-frame.c: Use C++ exception handling.
* python/py-finishbreakpoint.c: Use C++ exception handling.
* python/py-cmd.c: Use C++ exception handling.
* python/py-breakpoint.c: Use C++ exception handling.
* python/py-arch.c: Use C++ exception handling.
* printcmd.c: Use C++ exception handling.
* ppc-linux-tdep.c: Use C++ exception handling.
* parse.c: Use C++ exception handling.
* p-valprint.c: Use C++ exception handling.
* objc-lang.c: Use C++ exception handling.
* mi/mi-main.c: Use C++ exception handling.
* mi/mi-interp.c: Use C++ exception handling.
* mi/mi-cmd-stack.c: Use C++ exception handling.
* mi/mi-cmd-break.c: Use C++ exception handling.
* main.c: Use C++ exception handling.
* linux-thread-db.c: Use C++ exception handling.
* linux-tdep.c: Use C++ exception handling.
* linux-nat.c: Use C++ exception handling.
* linux-fork.c: Use C++ exception handling.
* linespec.c: Use C++ exception handling.
* language.c: Use C++ exception handling.
* jit.c: Use C++ exception handling.
* infrun.c: Use C++ exception handling.
* infcmd.c: Use C++ exception handling.
* infcall.c: Use C++ exception handling.
* inf-loop.c: Use C++ exception handling.
* i386-tdep.c: Use C++ exception handling.
* i386-linux-tdep.c: Use C++ exception handling.
* guile/scm-value.c: Use C++ exception handling.
* guile/scm-type.c: Use C++ exception handling.
* guile/scm-symtab.c: Use C++ exception handling.
* guile/scm-symbol.c: Use C++ exception handling.
* guile/scm-pretty-print.c: Use C++ exception handling.
* guile/scm-ports.c: Use C++ exception handling.
* guile/scm-param.c: Use C++ exception handling.
* guile/scm-math.c: Use C++ exception handling.
* guile/scm-lazy-string.c: Use C++ exception handling.
* guile/scm-frame.c: Use C++ exception handling.
* guile/scm-disasm.c: Use C++ exception handling.
* guile/scm-cmd.c: Use C++ exception handling.
* guile/scm-breakpoint.c: Use C++ exception handling.
* guile/scm-block.c: Use C++ exception handling.
* guile/guile-internal.h: Use C++ exception handling.
* gnu-v3-abi.c: Use C++ exception handling.
* gdbtypes.c: Use C++ exception handling.
* frame.c: Use C++ exception handling.
* frame-unwind.c: Use C++ exception handling.
* fbsd-tdep.c: Use C++ exception handling.
* f-valprint.c: Use C++ exception handling.
* exec.c: Use C++ exception handling.
* event-top.c: Use C++ exception handling.
* event-loop.c: Use C++ exception handling.
* eval.c: Use C++ exception handling.
* dwarf2read.c: Use C++ exception handling.
* dwarf2loc.c: Use C++ exception handling.
* dwarf2-frame.c: Use C++ exception handling.
* dwarf2-frame-tailcall.c: Use C++ exception handling.
* dwarf-index-write.c: Use C++ exception handling.
* dwarf-index-cache.c: Use C++ exception handling.
* dtrace-probe.c: Use C++ exception handling.
* disasm-selftests.c: Use C++ exception handling.
* darwin-nat.c: Use C++ exception handling.
* cp-valprint.c: Use C++ exception handling.
* cp-support.c: Use C++ exception handling.
* cp-abi.c: Use C++ exception handling.
* corelow.c: Use C++ exception handling.
* completer.c: Use C++ exception handling.
* compile/compile-object-run.c: Use C++ exception handling.
* compile/compile-object-load.c: Use C++ exception handling.
* compile/compile-cplus-symbols.c: Use C++ exception handling.
* compile/compile-c-symbols.c: Use C++ exception handling.
* common/selftest.c: Use C++ exception handling.
* common/new-op.c: Use C++ exception handling.
* cli/cli-script.c: Use C++ exception handling.
* cli/cli-interp.c: Use C++ exception handling.
* cli/cli-cmds.c: Use C++ exception handling.
* c-varobj.c: Use C++ exception handling.
* btrace.c: Use C++ exception handling.
* breakpoint.c: Use C++ exception handling.
* break-catch-throw.c: Use C++ exception handling.
* arch-utils.c: Use C++ exception handling.
* amd64-tdep.c: Use C++ exception handling.
* ada-valprint.c: Use C++ exception handling.
* ada-typeprint.c: Use C++ exception handling.
* ada-lang.c: Use C++ exception handling.
* aarch64-tdep.c: Use C++ exception handling.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* server.c: Use C++ exception handling.
* linux-low.c: Use C++ exception handling.
* gdbreplay.c: Use C++ exception handling.
Tom Tromey [Mon, 28 Jan 2019 17:11:10 +0000 (10:11 -0700)]
Make exceptions use std::string and be self-managing
This changes the exception's "message" member to be a shared_ptr
wrapping a std::string. This allows removing the stack of exception
messages, because now exceptions will self-destruct when needed. This
also adds a noexcept copy constructor and operator= to gdb_exception,
plus a "what" method.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* xml-support.c (gdb_xml_parser::parse): Update.
* x86-linux-nat.c (x86_linux_nat_target::enable_btrace): Update.
* value.c (show_convenience): Update.
* unittests/cli-utils-selftests.c (test_number_or_range_parser)
(test_parse_flags_qcs): Update.
* thread.c (thr_try_catch_cmd): Update.
* target.c (target_translate_tls_address): Update.
* stack.c (print_frame_arg, read_frame_local, read_frame_arg)
(info_frame_command_core, frame_apply_command_count): Update.
* rust-exp.y (rust_lex_exception_test): Update.
* riscv-tdep.c (riscv_print_one_register_info): Update.
* remote.c (remote_target::enable_btrace): Update.
* record-btrace.c (record_btrace_enable_warn): Update.
* python/py-utils.c (gdbpy_convert_exception): Update.
* printcmd.c (do_one_display, print_variable_and_value): Update.
* mi/mi-main.c (mi_print_exception): Update.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Use SCOPE_EXIT.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* linux-nat.c (linux_nat_target::attach): Update.
* linux-fork.c (class scoped_switch_fork_info): Update.
* infrun.c (displaced_step_prepare): Update.
* infcall.c (call_function_by_hand_dummy): Update.
* guile/scm-exception.c (gdbscm_scm_from_gdb_exception): Update.
* gnu-v3-abi.c (print_one_vtable): Update.
* frame.c (get_prev_frame_always): Update.
* f-valprint.c (info_common_command_for_block): Update.
* exec.c (try_open_exec_file): Update.
* exceptions.c (print_exception, exception_print)
(exception_fprintf, exception_print_same): Update.
* dwarf2-frame.c (dwarf2_build_frame_info): Update.
* dwarf-index-cache.c (index_cache::store)
(index_cache::lookup_gdb_index): Update.
* darwin-nat.c (maybe_cache_shell): Update.
* cp-valprint.c (cp_print_value_fields): Update.
* compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol)
(gcc_cplus_symbol_address): Update.
* compile/compile-c-symbols.c (gcc_convert_symbol)
(gcc_symbol_address, generate_c_for_for_one_variable): Update.
* common/selftest.c: Update.
* common/common-exceptions.h (struct gdb_exception) <message>: Now
a std::string.
(exception_try_scope_entry, exception_try_scope_exit): Don't
declare.
(struct exception_try_scope): Remove.
(TRY): Don't use exception_try_scope.
(struct gdb_exception): Add constructor, operator=.
<what>: New method.
(struct gdb_exception_RETURN_MASK_ALL)
(struct gdb_exception_RETURN_MASK_ERROR)
(struct gdb_exception_RETURN_MASK_QUIT): Add constructor.
(struct gdb_quit_bad_alloc): Update.
* common/common-exceptions.c (exception_none): Change
initializer.
(struct catcher) <state, exception>: Initialize inline.
<prev>: Remove member.
(current_catcher): Remove.
(catchers): New global.
(exceptions_state_mc_init): Simplify.
(catcher_pop): Remove.
(exceptions_state_mc, exceptions_state_mc_catch): Update.
(try_scope_depth, exception_try_scope_entry)
(exception_try_scope_exit): Remove.
(throw_exception_sjlj): Update.
(exception_messages, exception_messages_size): Remove.
(throw_it): Simplify.
(gdb_exception_sliced_copy): Remove.
(throw_exception_cxx): Update.
* cli/cli-script.c (script_from_file): Update.
* breakpoint.c (insert_bp_location, update_breakpoint_locations):
Update.
* ada-valprint.c (ada_val_print): Update.
* ada-lang.c (ada_to_fixed_type_1, ada_exception_name_addr)
(create_excep_cond_exprs): Update.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* server.c (handle_btrace_general_set, handle_qxfer_btrace)
(handle_qxfer_btrace_conf, detach_or_kill_for_exit_cleanup)
(captured_main, main): Update.
* gdbreplay.c (main): Update.
Tom Tromey [Fri, 25 Jan 2019 00:31:21 +0000 (17:31 -0700)]
Simplify exception handling
Now that cleanups have been removed, TRY/CATCH can't be SJLJ-based any
more. This patch simplifies the exception handling code, by removing
the non-working variants.
Note that the "pure" C++ exception handling code is removed as well; I
think the route forward must be to change exceptions to be
self-destructing, so that try_scope_depth can simply be removed.
Some longjmp-based code remains, as it is needed to throw an exception
through readline.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* common/common-exceptions.h (GDB_XCPT_SJMP, GDB_XCPT_TRY)
(GDB_XCPT_RAW_TRY, GDB_XCPT): Remove.
(TRY, CATCH, END_CATCH): Remove some definitions.
* common/common-exceptions.c: Don't use GDB_XCPT.
(catcher_list_size): Remove.
(throw_exception, throw_it): Simplify.
Alan Modra [Mon, 8 Apr 2019 04:37:35 +0000 (14:07 +0930)]
Fix i386-lynxos and other runtime linker fails
Segfaults due to htab->params being NULL.
* emulparams/elf64rdos.sh (EXTRA_EM_FILE): Define.
* emulparams/i386lynx.sh (EXTRA_EM_FILE): Define.
* emulparams/i386nto.sh (EXTRA_EM_FILE): Define.
Alan Modra [Mon, 8 Apr 2019 04:31:17 +0000 (14:01 +0930)]
Fix x86_64-rdos build fail
x86_64-rdos is one of the few x86_64 targets that is 64-bit only and
the x86_64 configure entries don't depend on elf-vxworks.lo. This
results in undefined references from elfxx-x86.o.
* configure.ac (elfxx_x86): Define and use.
* configure: Regenerate.
GDB Administrator [Mon, 8 Apr 2019 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 20 Oct 2018 18:30:00 +0000 (12:30 -0600)]
Make "all" depend on "info"
I've broken "make info" a couple of times now, because I sometimes
forget to run "make info" after modifying a Texinfo file.
I don't know why gdb's "make all" doesn't build the info pages. I
suspect this was some Cygnus-local oddity back in the day.
This patch changes doc/Makefile.in so that the info pages are built by
"make all". As a point of reference, Automake has essentially always
worked this way. According to the Automake manual (I didn't
double-check) this is required by the GNU coding standards.
The first time I sent this patch, I mentioned that I wanted to look
into some existing bugs in bugzilla about missing "makeinfo".
However, today I tried and I discovered that BFD requires makeinfo,
and builds its info file as part of "all". So, I think this change
doesn't worsen the situation for users in any way, and can simply go
in.
gdb/doc/ChangeLog
2019-04-07 Tom Tromey <tom@tromey.com>
* Makefile.in (all): Depend on "info".
Alan Modra [Sun, 7 Apr 2019 11:17:06 +0000 (20:47 +0930)]
print_insn_powerpc tidy
* ppc-dis.c (print_insn_powerpc): Use a tiny state machine
op_separator to control printing of spaces, comma and parens
rather than need_comma, need_paren and spaces vars.
Alan Modra [Sun, 7 Apr 2019 11:12:16 +0000 (20:42 +0930)]
PR24421, Wrong brackets in opcodes/arm-dis.c
PR 24421
* arm-dis.c (print_insn_coprocessor): Correct bracket placement.
(print_insn_neon, print_insn_arm): Likewise.
Alan Modra [Sun, 7 Apr 2019 11:11:49 +0000 (20:41 +0930)]
Merge libiberty from gcc
GDB Administrator [Sun, 7 Apr 2019 00:01:01 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 6 Apr 2019 19:38:10 +0000 (13:38 -0600)]
Revert the header-sorting patch
Andreas Schwab and John Baldwin pointed out some bugs in the header
sorting patch; and I noticed that the output was not correct when
limited to a subset of files (a bug in my script).
So, I'm reverting the patch. I may try again after fixing the issues
pointed out.
gdb/ChangeLog
2019-04-05 Tom Tromey <tom@tromey.com>
Revert the header-sorting patch.
* ft32-tdep.c: Revert.
* frv-tdep.c: Revert.
* frv-linux-tdep.c: Revert.
* frame.c: Revert.
* frame-unwind.c: Revert.
* frame-base.c: Revert.
* fork-child.c: Revert.
* findvar.c: Revert.
* findcmd.c: Revert.
* filesystem.c: Revert.
* filename-seen-cache.h: Revert.
* filename-seen-cache.c: Revert.
* fbsd-tdep.c: Revert.
* fbsd-nat.h: Revert.
* fbsd-nat.c: Revert.
* f-valprint.c: Revert.
* f-typeprint.c: Revert.
* f-lang.c: Revert.
* extension.h: Revert.
* extension.c: Revert.
* extension-priv.h: Revert.
* expprint.c: Revert.
* exec.h: Revert.
* exec.c: Revert.
* exceptions.c: Revert.
* event-top.c: Revert.
* event-loop.c: Revert.
* eval.c: Revert.
* elfread.c: Revert.
* dwarf2read.h: Revert.
* dwarf2read.c: Revert.
* dwarf2loc.c: Revert.
* dwarf2expr.h: Revert.
* dwarf2expr.c: Revert.
* dwarf2-frame.c: Revert.
* dwarf2-frame-tailcall.c: Revert.
* dwarf-index-write.h: Revert.
* dwarf-index-write.c: Revert.
* dwarf-index-common.c: Revert.
* dwarf-index-cache.h: Revert.
* dwarf-index-cache.c: Revert.
* dummy-frame.c: Revert.
* dtrace-probe.c: Revert.
* disasm.h: Revert.
* disasm.c: Revert.
* disasm-selftests.c: Revert.
* dictionary.c: Revert.
* dicos-tdep.c: Revert.
* demangle.c: Revert.
* dcache.h: Revert.
* dcache.c: Revert.
* darwin-nat.h: Revert.
* darwin-nat.c: Revert.
* darwin-nat-info.c: Revert.
* d-valprint.c: Revert.
* d-namespace.c: Revert.
* d-lang.c: Revert.
* ctf.c: Revert.
* csky-tdep.c: Revert.
* csky-linux-tdep.c: Revert.
* cris-tdep.c: Revert.
* cris-linux-tdep.c: Revert.
* cp-valprint.c: Revert.
* cp-support.c: Revert.
* cp-namespace.c: Revert.
* cp-abi.c: Revert.
* corelow.c: Revert.
* corefile.c: Revert.
* continuations.c: Revert.
* completer.h: Revert.
* completer.c: Revert.
* complaints.c: Revert.
* coffread.c: Revert.
* coff-pe-read.c: Revert.
* cli-out.h: Revert.
* cli-out.c: Revert.
* charset.c: Revert.
* c-varobj.c: Revert.
* c-valprint.c: Revert.
* c-typeprint.c: Revert.
* c-lang.c: Revert.
* buildsym.c: Revert.
* buildsym-legacy.c: Revert.
* build-id.h: Revert.
* build-id.c: Revert.
* btrace.c: Revert.
* bsd-uthread.c: Revert.
* breakpoint.h: Revert.
* breakpoint.c: Revert.
* break-catch-throw.c: Revert.
* break-catch-syscall.c: Revert.
* break-catch-sig.c: Revert.
* blockframe.c: Revert.
* block.c: Revert.
* bfin-tdep.c: Revert.
* bfin-linux-tdep.c: Revert.
* bfd-target.c: Revert.
* bcache.c: Revert.
* ax-general.c: Revert.
* ax-gdb.h: Revert.
* ax-gdb.c: Revert.
* avr-tdep.c: Revert.
* auxv.c: Revert.
* auto-load.c: Revert.
* arm-wince-tdep.c: Revert.
* arm-tdep.c: Revert.
* arm-symbian-tdep.c: Revert.
* arm-pikeos-tdep.c: Revert.
* arm-obsd-tdep.c: Revert.
* arm-nbsd-tdep.c: Revert.
* arm-nbsd-nat.c: Revert.
* arm-linux-tdep.c: Revert.
* arm-linux-nat.c: Revert.
* arm-fbsd-tdep.c: Revert.
* arm-fbsd-nat.c: Revert.
* arm-bsd-tdep.c: Revert.
* arch-utils.c: Revert.
* arc-tdep.c: Revert.
* arc-newlib-tdep.c: Revert.
* annotate.h: Revert.
* annotate.c: Revert.
* amd64-windows-tdep.c: Revert.
* amd64-windows-nat.c: Revert.
* amd64-tdep.c: Revert.
* amd64-sol2-tdep.c: Revert.
* amd64-obsd-tdep.c: Revert.
* amd64-obsd-nat.c: Revert.
* amd64-nbsd-tdep.c: Revert.
* amd64-nbsd-nat.c: Revert.
* amd64-nat.c: Revert.
* amd64-linux-tdep.c: Revert.
* amd64-linux-nat.c: Revert.
* amd64-fbsd-tdep.c: Revert.
* amd64-fbsd-nat.c: Revert.
* amd64-dicos-tdep.c: Revert.
* amd64-darwin-tdep.c: Revert.
* amd64-bsd-nat.c: Revert.
* alpha-tdep.c: Revert.
* alpha-obsd-tdep.c: Revert.
* alpha-nbsd-tdep.c: Revert.
* alpha-mdebug-tdep.c: Revert.
* alpha-linux-tdep.c: Revert.
* alpha-linux-nat.c: Revert.
* alpha-bsd-tdep.c: Revert.
* alpha-bsd-nat.c: Revert.
* aix-thread.c: Revert.
* agent.c: Revert.
* addrmap.c: Revert.
* ada-varobj.c: Revert.
* ada-valprint.c: Revert.
* ada-typeprint.c: Revert.
* ada-tasks.c: Revert.
* ada-lang.c: Revert.
* aarch64-tdep.c: Revert.
* aarch64-ravenscar-thread.c: Revert.
* aarch64-newlib-tdep.c: Revert.
* aarch64-linux-tdep.c: Revert.
* aarch64-linux-nat.c: Revert.
* aarch64-fbsd-tdep.c: Revert.
* aarch64-fbsd-nat.c: Revert.
* aarch32-linux-nat.c: Revert.
H.J. Lu [Sat, 6 Apr 2019 14:25:10 +0000 (07:25 -0700)]
x86: Move x86-specific linker options to elf_linker_x86_params
Remove x86-specific linker options from bfd_link_info and put them in
elf_linker_x86_params. Add _bfd_elf_linker_x86_set_options to pass
x86-specific linker options from ld to bfd.
bfd/
* elf-linker-x86.h: New file.
* elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params
to get x86-specific linker options.
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
(elf_x86_64_check_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_link_setup_gnu_properties): Likewise.
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise.
(_bfd_x86_elf_link_setup_gnu_properties): Likewise.
(_bfd_elf_linker_x86_set_options): New function.
* elfxx-x86.h: Include "elf-linker-x86.h".
(elf_x86_link_hash_table): Add params.
include/
* bfdlink.h (bfd_link_info): Remove x86-specific linker options.
ld/
* Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em.
(eelf_i386_sol2.c): Also depend on
$(srcdir)/emultempl/solaris2-x86.em.
(eelf_x86_64_sol2.c): Likewise.
* Makefile.in: Regenerated.
* emulparams/call_nop.sh: Set x86-specific linker options via
params.
* emulparams/cet.sh: Likewise.
* emulparams/reloc_overflow.sh: Likewise.
* emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to
"elf-x86".
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_i386_be.sh: Likewise.
* emulparams/elf_i386_chaos.sh: Likewise.
* emulparams/elf_i386_ldso.sh: Likewise.
* emulparams/elf_i386_vxworks.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_k1om.sh: Likewise.
* emulparams/elf_l1om.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to
"solaris2-x86".
* emulparams/elf_x86_64_sol2.sh: Likewise.
* emultempl/elf-x86.em: New file.
* emultempl/solaris2-x86.em: Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't
set link_info.call_nop_byte.
Tom Tromey [Wed, 3 Apr 2019 02:04:24 +0000 (20:04 -0600)]
Sort includes for files gdb/[a-f]*.[chyl].
This patch sorts the include files for the files [a-f]*.[chyl].
The patch was written by a script.
Tested by the buildbot.
I will follow up with patches to sort the remaining files, by sorting
a subset, testing them, and then checking them in.
gdb/ChangeLog
2019-04-05 Tom Tromey <tom@tromey.com>
* ft32-tdep.c: Sort headers.
* frv-tdep.c: Sort headers.
* frv-linux-tdep.c: Sort headers.
* frame.c: Sort headers.
* frame-unwind.c: Sort headers.
* frame-base.c: Sort headers.
* fork-child.c: Sort headers.
* findvar.c: Sort headers.
* findcmd.c: Sort headers.
* filesystem.c: Sort headers.
* filename-seen-cache.h: Sort headers.
* filename-seen-cache.c: Sort headers.
* fbsd-tdep.c: Sort headers.
* fbsd-nat.h: Sort headers.
* fbsd-nat.c: Sort headers.
* f-valprint.c: Sort headers.
* f-typeprint.c: Sort headers.
* f-lang.c: Sort headers.
* extension.h: Sort headers.
* extension.c: Sort headers.
* extension-priv.h: Sort headers.
* expprint.c: Sort headers.
* exec.h: Sort headers.
* exec.c: Sort headers.
* exceptions.c: Sort headers.
* event-top.c: Sort headers.
* event-loop.c: Sort headers.
* eval.c: Sort headers.
* elfread.c: Sort headers.
* dwarf2read.h: Sort headers.
* dwarf2read.c: Sort headers.
* dwarf2loc.c: Sort headers.
* dwarf2expr.h: Sort headers.
* dwarf2expr.c: Sort headers.
* dwarf2-frame.c: Sort headers.
* dwarf2-frame-tailcall.c: Sort headers.
* dwarf-index-write.h: Sort headers.
* dwarf-index-write.c: Sort headers.
* dwarf-index-common.c: Sort headers.
* dwarf-index-cache.h: Sort headers.
* dwarf-index-cache.c: Sort headers.
* dummy-frame.c: Sort headers.
* dtrace-probe.c: Sort headers.
* disasm.h: Sort headers.
* disasm.c: Sort headers.
* disasm-selftests.c: Sort headers.
* dictionary.c: Sort headers.
* dicos-tdep.c: Sort headers.
* demangle.c: Sort headers.
* dcache.h: Sort headers.
* dcache.c: Sort headers.
* darwin-nat.h: Sort headers.
* darwin-nat.c: Sort headers.
* darwin-nat-info.c: Sort headers.
* d-valprint.c: Sort headers.
* d-namespace.c: Sort headers.
* d-lang.c: Sort headers.
* ctf.c: Sort headers.
* csky-tdep.c: Sort headers.
* csky-linux-tdep.c: Sort headers.
* cris-tdep.c: Sort headers.
* cris-linux-tdep.c: Sort headers.
* cp-valprint.c: Sort headers.
* cp-support.c: Sort headers.
* cp-namespace.c: Sort headers.
* cp-abi.c: Sort headers.
* corelow.c: Sort headers.
* corefile.c: Sort headers.
* continuations.c: Sort headers.
* completer.h: Sort headers.
* completer.c: Sort headers.
* complaints.c: Sort headers.
* coffread.c: Sort headers.
* coff-pe-read.c: Sort headers.
* cli-out.h: Sort headers.
* cli-out.c: Sort headers.
* charset.c: Sort headers.
* c-varobj.c: Sort headers.
* c-valprint.c: Sort headers.
* c-typeprint.c: Sort headers.
* c-lang.c: Sort headers.
* buildsym.c: Sort headers.
* buildsym-legacy.c: Sort headers.
* build-id.h: Sort headers.
* build-id.c: Sort headers.
* btrace.c: Sort headers.
* bsd-uthread.c: Sort headers.
* breakpoint.h: Sort headers.
* breakpoint.c: Sort headers.
* break-catch-throw.c: Sort headers.
* break-catch-syscall.c: Sort headers.
* break-catch-sig.c: Sort headers.
* blockframe.c: Sort headers.
* block.c: Sort headers.
* bfin-tdep.c: Sort headers.
* bfin-linux-tdep.c: Sort headers.
* bfd-target.c: Sort headers.
* bcache.c: Sort headers.
* ax-general.c: Sort headers.
* ax-gdb.h: Sort headers.
* ax-gdb.c: Sort headers.
* avr-tdep.c: Sort headers.
* auxv.c: Sort headers.
* auto-load.c: Sort headers.
* arm-wince-tdep.c: Sort headers.
* arm-tdep.c: Sort headers.
* arm-symbian-tdep.c: Sort headers.
* arm-pikeos-tdep.c: Sort headers.
* arm-obsd-tdep.c: Sort headers.
* arm-nbsd-tdep.c: Sort headers.
* arm-nbsd-nat.c: Sort headers.
* arm-linux-tdep.c: Sort headers.
* arm-linux-nat.c: Sort headers.
* arm-fbsd-tdep.c: Sort headers.
* arm-fbsd-nat.c: Sort headers.
* arm-bsd-tdep.c: Sort headers.
* arch-utils.c: Sort headers.
* arc-tdep.c: Sort headers.
* arc-newlib-tdep.c: Sort headers.
* annotate.h: Sort headers.
* annotate.c: Sort headers.
* amd64-windows-tdep.c: Sort headers.
* amd64-windows-nat.c: Sort headers.
* amd64-tdep.c: Sort headers.
* amd64-sol2-tdep.c: Sort headers.
* amd64-obsd-tdep.c: Sort headers.
* amd64-obsd-nat.c: Sort headers.
* amd64-nbsd-tdep.c: Sort headers.
* amd64-nbsd-nat.c: Sort headers.
* amd64-nat.c: Sort headers.
* amd64-linux-tdep.c: Sort headers.
* amd64-linux-nat.c: Sort headers.
* amd64-fbsd-tdep.c: Sort headers.
* amd64-fbsd-nat.c: Sort headers.
* amd64-dicos-tdep.c: Sort headers.
* amd64-darwin-tdep.c: Sort headers.
* amd64-bsd-nat.c: Sort headers.
* alpha-tdep.c: Sort headers.
* alpha-obsd-tdep.c: Sort headers.
* alpha-nbsd-tdep.c: Sort headers.
* alpha-mdebug-tdep.c: Sort headers.
* alpha-linux-tdep.c: Sort headers.
* alpha-linux-nat.c: Sort headers.
* alpha-bsd-tdep.c: Sort headers.
* alpha-bsd-nat.c: Sort headers.
* aix-thread.c: Sort headers.
* agent.c: Sort headers.
* addrmap.c: Sort headers.
* ada-varobj.c: Sort headers.
* ada-valprint.c: Sort headers.
* ada-typeprint.c: Sort headers.
* ada-tasks.c: Sort headers.
* ada-lang.c: Sort headers.
* aarch64-tdep.c: Sort headers.
* aarch64-ravenscar-thread.c: Sort headers.
* aarch64-newlib-tdep.c: Sort headers.
* aarch64-linux-tdep.c: Sort headers.
* aarch64-linux-nat.c: Sort headers.
* aarch64-fbsd-tdep.c: Sort headers.
* aarch64-fbsd-nat.c: Sort headers.
* aarch32-linux-nat.c: Sort headers.
GDB Administrator [Sat, 6 Apr 2019 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 5 Apr 2019 19:41:58 +0000 (12:41 -0700)]
x86: Add assembler -mx86-used-note=yes test
Check assembler -mx86-used-note=yes option and readelf -n output.
* testsuite/gas/i386/i386.exp: Run -mx86-used-note=yes tests.
* testsuite/gas/i386/property-2.d: New file.
* testsuite/gas/i386/property-2.s: Likewise.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.
Xuepeng Guo [Fri, 5 Apr 2019 18:03:01 +0000 (11:03 -0700)]
x86: Support Intel AVX512 BF16
Add assembler and disassembler support Intel AVX512 BF16:
https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference
gas/
2019-04-05 Xuepeng Guo <xuepeng.guo@intel.com>
* config/tc-i386.c (cpu_arch): Add .avx512_bf16.
(cpu_noarch): Add noavx512_bf16.
* doc/c-i386.texi: Document avx512_bf16.
* testsuite/gas/i386/avx512_bf16.d: New file.
* testsuite/gas/i386/avx512_bf16.s: Likewise.
* testsuite/gas/i386/avx512_bf16_vl-inval.l: Likewise.
* testsuite/gas/i386/avx512_bf16_vl-inval.s: Likewise.
* testsuite/gas/i386/avx512_bf16_vl.d: Likewise.
* testsuite/gas/i386/avx512_bf16_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16_vl-inval.l: Likesie.
* testsuite/gas/i386/x86-64-avx512_bf16_vl-inval.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16_vl.s: Likewise.
* testsuite/gas/i386/i386.exp: Add BF16 related tests.
opcodes/
2019-04-05 Xuepeng Guo <xuepeng.guo@intel.com>
* i386-dis-evex.h (evex_table): Updated to support BF16
instructions.
* i386-dis.c (enum): Add EVEX_W_0F3852_P_1, EVEX_W_0F3872_P_1
and EVEX_W_0F3872_P_3.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_BF16_FLAGS.
(cpu_flags): Add bitfield for CpuAVX512_BF16.
* i386-opc.h (enum): Add CpuAVX512_BF16.
(i386_cpu_flags): Add bitfield for cpuavx512_bf16.
* i386-opc.tbl: Add AVX512 BF16 instructions.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
Pedro Franco de Carvalho [Fri, 5 Apr 2019 17:19:08 +0000 (14:19 -0300)]
Use linux_get_auxv to get AT_PHDR in the PPC stub
This patch fixes a build error due to a call to ppc_get_auxv that was
left over after linux_get_hwcap and linux_get_hwcap2 were introduced
in:
974c89e0882ddb03e294eca76a9e3d3bef90eacf gdbserver: Add
linux_get_hwcap
Because the missing call fetched AT_PHDR and not AT_HWCAP,
linux_get_auxv is now visible.
This use also required ppc_get_auxv to return a status variable
indicating that the AT_PHDR entry was not found separately from the
actual value of of the auxv entry. Therefore, the new linux_get_auxv
function is changed to return a status variable and write the entry
value to a pointer passed as an argument.
Note that linux_get_hwcap and linux_get_hwcap2 still use the return
value as both an indicator of that the entry wasn't found and as the
actual value of the entry.
gdb/gdbserver/ChangeLog:
2019-04-05 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* linux-low.c (linux_get_auxv): Remove static. Return auxv entry
value in argument pointer, return 1 if the entry is found and 0
otherwise. Move comment.
(linux_get_hwcap, linux_get_hwcap2): Use modified linux_get_auxv.
* linux-low.h (linux_get_auxv): Declare.
* linux-ppc-low.c (is_elfv2_inferior): Use linux_get_auxv.
Tom Tromey [Thu, 4 Apr 2019 22:48:28 +0000 (16:48 -0600)]
Use upper-case for metasyntactic in gdbserver help
I noticed that "gdbserver --help" contains a few metasyntactic
variables that aren't in upper-case. This patch fixes them to conform
to the GNU standard.
gdb/gdbserver/ChangeLog
2019-04-05 Tom Tromey <tromey@adacore.com>
* server.c (gdbserver_usage): Use upper-case for metasyntactic
variables.
Tom Tromey [Sun, 31 Mar 2019 23:20:24 +0000 (17:20 -0600)]
Move innermost_block_tracker global to parse_state
This changes the parsing API so that callers that are interested in
tracking the innermost block must instantiate an
innermost_block_tracker and pass it in. Then, a pointer to this
object is stored in the parser_state.
2019-04-04 Tom Tromey <tom@tromey.com>
* varobj.c (varobj_create): Update.
* rust-exp.y (struct rust_parser) <update_innermost_block,
lookup_symbol>: New methods.
(rust_parser::update_innermost_block, rust_parser::lookup_symbol):
Rename.
(rust_parser::rust_lookup_type)
(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
* printcmd.c (display_command, do_one_display): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add
"tracker" parameter.
(block_tracker): New member.
(class innermost_block_tracker) <innermost_block_tracker>: Add
"types" parameter.
<reset>: Remove method.
(innermost_block): Don't declare.
(null_post_parser): Update.
* parse.c (innermost_block): Remove global.
(write_dollar_variable): Update.
(parse_exp_1, parse_exp_in_context): Add "tracker" parameter.
Remove "tracker_types" parameter.
(parse_expression): Add "tracker" parameter.
(parse_expression_for_completion): Update.
(null_post_parser): Add "tracker" parameter.
* p-exp.y: Update rules.
* m2-exp.y: Update rules.
* language.h (struct language_defn) <la_post_parser>: Add
"tracker" parameter.
* go-exp.y: Update rules.
* f-exp.y: Update rules.
* expression.h (parse_expression, parse_exp_1): Add "tracker"
parameter.
* d-exp.y: Update rules.
* c-exp.y: Update rules.
* breakpoint.c (set_breakpoint_condition): Create an
innermost_block_tracker.
(watch_command_1): Likewise.
* ada-lang.c (resolve): Add "tracker" parameter.
(resolve_subexp): Likewise.
* ada-exp.y (write_var_from_sym): Update.
Tom Tromey [Sun, 31 Mar 2019 19:43:54 +0000 (13:43 -0600)]
Move type stack handling to a new class
This introduces a new "type_stack" class, and moves all the parser
type stack handling to this class. Parsers that wish to use this
facility must now instantiate this class somehow. I chose this
approach because a minority of the existing parsers require this.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* type-stack.h: New file.
* type-stack.c: New file.
* parser-defs.h (enum type_pieces, union type_stack_elt): Move to
type-stack.h.
(insert_into_type_stack, insert_type, push_type, push_type_int)
(insert_type_address_space, pop_type, pop_type_int)
(pop_typelist, pop_type_stack, append_type_stack)
(push_type_stack, get_type_stack, push_typelist)
(follow_type_instance_flags, follow_types): Don't declare.
* parse.c (type_stack): Remove global.
(parse_exp_in_context): Update.
(insert_into_type_stack, insert_type, push_type, push_type_int)
(insert_type_address_space, pop_type, pop_type_int)
(pop_typelist, pop_type_stack, append_type_stack)
(push_type_stack, get_type_stack, push_typelist)
(follow_type_instance_flags, follow_types): Remove (moved to
type-stack.c).
* f-exp.y (type_stack): New global.
Update rules.
(push_kind_type, f_parse): Update.
* d-exp.y (type_stack): New global.
Update rules.
(d_parse): Update.
* c-exp.y (struct c_parse_state) <type_stack>: New member.
Update rules.
* Makefile.in (COMMON_SFILES): Add type-stack.c.
(HFILES_NO_SRCDIR): Add type-stack.h.
Tom Tromey [Mon, 25 Mar 2019 04:50:14 +0000 (22:50 -0600)]
Move completion parsing to parser_state
This moves the globals and functions related to parsing for completion
to parser_state. A new structure is introduced in order to return
completion results from the parse back to
parse_expression_for_completion.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (rust_parser::lex_identifier, rustyylex)
(rust_parser::convert_ast_to_expression, rust_parse)
(rust_lex_test_completion, rust_lex_tests): Update.
* parser-defs.h (struct expr_completion_state): New.
(struct parser_state) <parser_state>: Add completion parameter.
<mark_struct_expression, mark_completion_tag>: New methods.
<parse_completion, m_completion_state>: New members.
(prefixify_expression, null_post_parser): Update.
(mark_struct_expression, mark_completion_tag): Don't declare.
* parse.c (parse_completion, expout_last_struct)
(expout_tag_completion_type, expout_completion_name): Remove
globals.
(parser_state::mark_struct_expression)
(parser_state::mark_completion_tag): Now methods.
(prefixify_expression): Add last_struct parameter.
(prefixify_subexp): Likewise.
(parse_exp_1): Update.
(parse_exp_in_context): Add cstate parameter. Update.
(parse_expression_for_completion): Create an
expr_completion_state.
(null_post_parser): Add "completion" parameter.
* p-exp.y: Update rules.
(yylex): Update.
* language.h (struct language_defn) <la_post_parser>: Add
"completing" parameter.
* go-exp.y: Update rules.
(lex_one_token): Update.
* expression.h (parse_completion): Don't declare.
* d-exp.y: Update rules.
(lex_one_token): Update rules.
* c-exp.y: Update rules.
(lex_one_token): Update.
* ada-lang.c (resolve): Add "parse_completion" parameter.
(resolve_subexp): Likewise.
(ada_resolve_function): Likewise.
Tom Tromey [Mon, 25 Mar 2019 03:38:40 +0000 (21:38 -0600)]
Move arglist_len et al to parser_state
This moves arglist_len, start_arglist, and end_arglist to
parser_state.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* parser-defs.h (struct parser_state) <start_arglist,
end_arglist>: New methods.
<arglist_len, m_funcall_chain>: New members.
(arglist_len, start_arglist, end_arglist): Don't declare.
* parse.c (arglist_len, funcall_chain): Remove global.
(start_arglist, end_arglist): Remove functions.
(parse_exp_in_context): Update.
* p-exp.y: Update rules.
* m2-exp.y: Update rules.
* go-exp.y: Update rules.
* f-exp.y: Update rules.
* d-exp.y: Update rules.
* c-exp.y: Update rules.
Tom Tromey [Mon, 25 Mar 2019 03:30:56 +0000 (21:30 -0600)]
Move lexptr and prev_lexptr to parser_state
This removes the lexptr and prev_lexptr globals, in favor of members
of parser_state. prev_lexptr could be isolated to each parser, but
since every parser uses it, that did not seem necessary.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (struct rust_parser) <lex_hex, lex_escape,
lex_operator, push_back>: New methods.
Update all rules.
(rust_parser::lex_hex, lex_escape): Rename and update.
(rust_parser::lex_string, rust_parser::lex_identifier): Update.
(rust_parser::lex_operator): Rename and update.
(rust_parser::lex_number, rustyylex, rustyyerror)
(rust_lex_test_init, rust_lex_test_sequence)
(rust_lex_test_push_back, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add "input"
parameter.
<lexptr, prev_lexptr>: New members.
(lexptr, prev_lexptr): Don't declare.
* parse.c (lexptr, prev_lexptr): Remove globals.
(parse_exp_in_context): Update.
* p-exp.y (yylex, yyerror): Update.
* m2-exp.y (parse_number, yylex, yyerror): Update.
* go-exp.y (lex_one_token, yyerror): Update.
* f-exp.y (match_string_literal, yylex, yyerror): Update.
* d-exp.y (lex_one_token, yyerror): Update.
* c-exp.y (scan_macro_expansion, finished_macro_expansion)
(lex_one_token, yyerror): Update.
* ada-lex.l (YY_INPUT): Update.
(rewind_to_char): Update.
* ada-exp.y (yyerror): Update.
Tom Tromey [Mon, 25 Mar 2019 00:07:00 +0000 (18:07 -0600)]
Move comma_terminates global to parser_state
This moves the comma_terminates global to parser_state.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (rustyylex, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add new
parameter.
<comma_terminates>: New member.
(comma_terminates): Don't declare global.
* parse.c (comma_terminates): Remove global.
(parse_exp_in_context): Update.
* p-exp.y (yylex): Update.
* m2-exp.y (yylex): Update.
* go-exp.y (lex_one_token): Update.
* f-exp.y (yylex): Update.
* d-exp.y (lex_one_token): Update.
* c-exp.y (lex_one_token): Update.
* ada-lex.l: Update.
Tom Tromey [Sun, 24 Mar 2019 17:33:10 +0000 (11:33 -0600)]
Remove paren_depth global
This removes the "paren_depth" global. In most cases, it is made into
a static global in a given parser. I consider this a slight
improvement, because it makes it clear that the variable isn't used
for communication between different modules of gdb. The one exception
is the Rust parser, which already incorporates all local state into a
transient object; in this case the parser depth is now a member.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (struct rust_parser) <paren_depth>: New member.
(rustyylex, rust_lex_test_init, rust_lex_test_one)
(rust_lex_test_sequence, rust_lex_test_push_back): Update.
* parser-defs.h (paren_depth): Don't declare.
* parse.c (paren_depth): Remove global.
(parse_exp_in_context): Update.
* p-exp.y (paren_depth): New global.
(pascal_parse): Initialize it.
* m2-exp.y (paren_depth): New global.
(m2_parse): Initialize it.
* go-exp.y (paren_depth): New global.
(go_parse): Initialize it.
* f-exp.y (paren_depth): New global.
(f_parse): Initialize it.
* d-exp.y (paren_depth): New global.
(d_parse): Initialize it.
* c-exp.y (paren_depth): New global.
(c_parse): Initialize it.
* ada-lex.l (paren_depth): New global.
(lexer_init): Initialize it.
Tom Tromey [Sun, 24 Mar 2019 17:20:05 +0000 (11:20 -0600)]
Move expression_context_* globals to parser_state
This moves the expression_context_block and expression_context_pc
globals to be members of parser_state and updates the parsers.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (rust_parser::crate_name, rust_parser::super_name)
(rust_parser::convert_ast_to_type)
(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add
parameters. Initialize new members.
<expression_context_block, expression_context_pc>: New members.
* parse.c (expression_context_block, expression_context_pc):
Remove globals.
(parse_exp_in_context): Update.
* p-exp.y: Update all rules.
(yylex): Update.
* m2-exp.y: Update all rules.
(yylex): Update.
* go-exp.y (yylex): Update.
* f-exp.y (yylex): Update.
* d-exp.y: Update all rules.
(yylex): Update.
* c-exp.y: Update all rules.
(lex_one_token, classify_name, yylex, c_parse): Update.
* ada-exp.y (write_var_or_type, write_name_assoc): Update.
Tom Tromey [Sun, 24 Mar 2019 16:28:42 +0000 (10:28 -0600)]
Make base class for parser_state
This makes a new base class, expr_builder, for parser_state. This
separates the state needed to construct an expression from the state
needed by the parsers.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* gdbarch.h, gdbarch.c: Rebuild.
* gdbarch.sh (dtrace_parse_probe_argument): Change type.
* stap-probe.h:
(struct stap_parse_info): Replace "parser_state" with
"expr_builder".
* parser-defs.h (struct expr_builder): Rename from "parser_state".
(parser_state): New class.
* parse.c (expr_builder): Rename.
(expr_builder::release): Rename.
(write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym)
(write_exp_elt_msym, write_exp_elt_block, write_exp_elt_objfile)
(write_exp_elt_longcst, write_exp_elt_floatcst)
(write_exp_elt_type, write_exp_elt_intern, write_exp_string)
(write_exp_string_vector, write_exp_bitstring)
(write_exp_msymbol, mark_struct_expression)
(write_dollar_variable)
(insert_type_address_space, increase_expout_size): Replace
"parser_state" with "expr_builder".
* dtrace-probe.c: Replace "parser_state" with "expr_builder".
* amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Replace
"parser_state" with "expr_builder".
Tom Tromey [Sun, 24 Mar 2019 15:01:18 +0000 (09:01 -0600)]
Turn parse_language into a method
This changes parse_language into a method of parser_state. This patch
was written by a script.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y: Replace "parse_language" with method call.
* p-exp.y:
(yylex): Replace "parse_language" with method call.
* m2-exp.y:
(yylex): Replace "parse_language" with method call.
* go-exp.y (classify_name): Replace "parse_language" with method
call.
* f-exp.y (yylex): Replace "parse_language" with method call.
* d-exp.y (lex_one_token): Replace "parse_language" with method
call.
* c-exp.y:
(lex_one_token, classify_name, yylex): Replace "parse_language"
with method call.
* ada-exp.y (find_primitive_type, type_char)
(type_system_address): Replace "parse_language" with method call.
Tom Tromey [Sun, 24 Mar 2019 14:56:33 +0000 (08:56 -0600)]
Turn parse_gdbarch into a method
This changes parse_gdbarch into a method of parser_state. This patch
was written by a script.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y: Replace "parse_gdbarch" with method call.
* parse.c (write_dollar_variable, insert_type_address_space):
Replace "parse_gdbarch" with method call.
* p-exp.y (parse_type, yylex): Replace "parse_gdbarch" with method
call.
* objc-lang.c (end_msglist): Replace "parse_gdbarch" with method
call.
* m2-exp.y (parse_type, parse_m2_type, yylex): Replace
"parse_gdbarch" with method call.
* go-exp.y (parse_type, classify_name): Replace "parse_gdbarch"
with method call.
* f-exp.y (parse_type, parse_f_type, yylex): Replace
"parse_gdbarch" with method call.
* d-exp.y (parse_type, parse_d_type, lex_one_token): Replace
"parse_gdbarch" with method call.
* c-exp.y (parse_type, parse_number, classify_name): Replace
"parse_gdbarch" with method call.
* ada-lex.l: Replace "parse_gdbarch" with method call.
* ada-exp.y (parse_type, find_primitive_type, type_char)
(type_system_address): Replace "parse_gdbarch" with method call.
Tom Tromey [Sun, 24 Mar 2019 14:40:32 +0000 (08:40 -0600)]
Remove parser_state "initial_size" parameter
All the real (not test) uses of parser_state pass 10 as the
"initial_size" parameter, and it seems to me that there's no real
reason to require callers to set this. This patch removes this
parameter.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
* stap-probe.c (stap_parse_argument): Update.
* stap-probe.h (struct stap_parse_info) <stap_parse_info>: Remove
initial_size parameter.
* rust-exp.y (rust_lex_tests): Update.
* parse.c (parser_state): Update.
(parse_exp_in_context): Update.
* parser-defs.h (struct parser_state) <parser_state>: Remove
"initial_size" parameter.
Tom Tromey [Sun, 24 Mar 2019 14:25:58 +0000 (08:25 -0600)]
Make increase_expout_size static
increase_expout_size is only called from parse.c, and probably only
should be. This makes it "static". Tested by rebuilding.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* parser-defs.h (increase_expout_size): Don't declare.
* parse.c (increase_expout_size): Now static.
Alan Modra [Thu, 4 Apr 2019 01:32:31 +0000 (12:02 +1030)]
PowerPC conditional branch test
Adds a new test checking conditional branch BO values.
* testsuite/gas/ppc/bc.s,
* testsuite/gas/ppc/bcat.d,
* testsuite/gas/ppc/bcaterr.d,
* testsuite/gas/ppc/bcaterr.l,
* testsuite/gas/ppc/bcy.d,
* testsuite/gas/ppc/bcyerr.d,
* testsuite/gas/ppc/bcyerr.l: New tests.
* testsuite/gas/ppc/ppc.exp: Run them.
Alan Modra [Thu, 4 Apr 2019 07:49:03 +0000 (18:19 +1030)]
PowerPC bc extended branch mnemonics and "y" hints
This patch fixes a problem with disassembly of branch instructions
for processors complying with PowerPC ISA versions prior to version
2.0, ie. those that use "y" bit branch taken hints. Many of the
extended bcctr and bclr mnemonics that should have disassembled with a
"-" suffix, ie. not taken, did not display the "-" due to the ordering
in powerpc_opcodes. I believe it's been that way from the original
85dcf36d72b commit of ppc-opc.c.
I've also added a BH field (optional) to a few opcodes. This gives
better disassembly in raw mode, showing the branch taken hint in the
mnemonic as is done for bc. It would be reasonable to add a BH
field to all bcctr, bclr, and bctar extended mnemonics but that runs
into a small difficulty: Currently we print all or none of the
optional operands. That means for example that "bgectr cr2" would
display as "bgectr cr2,0" if a BH field is added to bgectr.
* ppc-opc.c (XLBH_MASK): Subtract off BH field from BB_MASK.
(powerpc_opcodes): Reorder bcctr and bclr extended mnemonics
to favour printing of "-" branch hint when using the "y" bit.
Allow BH field on bc{ctr,lr,tar}{,l}{-,+}.
Alan Modra [Thu, 4 Apr 2019 22:50:16 +0000 (09:20 +1030)]
PowerPC disassembler: Don't emit trailing spaces
When an instruction has operands, the PowerPC disassembler prints
spaces after the opcode so as to line up operands. If the operands
are all optional and all default value, then no operands are printed,
leaving trailing spaces. This patch fixes that.
opcodes/
* ppc-dis.c (print_insn_powerpc): Delay printing spaces after
opcode until first operand is output.
gas/
* testsuite/gas/ppc/476.d: Remove trailing spaces.
* testsuite/gas/ppc/a2.d: Likewise.
* testsuite/gas/ppc/booke.d: Likewise.
* testsuite/gas/ppc/booke_xcoff.d: Likewise.
* testsuite/gas/ppc/e500.d: Likewise.
* testsuite/gas/ppc/e500mc.d: Likewise.
* testsuite/gas/ppc/e6500.d: Likewise.
* testsuite/gas/ppc/htm.d: Likewise.
* testsuite/gas/ppc/power6.d: Likewise.
* testsuite/gas/ppc/power8.d: Likewise.
* testsuite/gas/ppc/power9.d: Likewise.
* testsuite/gas/ppc/vle.d: Likewise.
ld/
* testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces.
* testsuite/ld-powerpc/tlsopt5.d: Likewise.
* testsuite/ld-powerpc/tlsopt5_32.d: Likewise.
GDB Administrator [Fri, 5 Apr 2019 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Peter Bergner [Thu, 4 Apr 2019 14:00:29 +0000 (09:00 -0500)]
Add extended mnemonics for bctar. Fix setting of 'at' branch hints.
opcodes/
PR gas/24349
* ppc-opc.c (valid_bo_pre_v2): Add comments.
(valid_bo_post_v2): Add support for 'at' branch hints.
(insert_bo): Only error on branch on ctr.
(get_bo_hint_mask): New function.
(insert_boe): Add new 'branch_taken' formal argument. Add support
for inserting 'at' branch hints.
(extract_boe): Add new 'branch_taken' formal argument. Add support
for extracting 'at' branch hints.
(insert_bom, extract_bom, insert_bop, extract_bop): New functions.
(BOE): Delete operand.
(BOM, BOP): New operands.
(RM): Update value.
(XLYLK, XLYLK_MASK, XLYBB_MASK): Delete.
(powerpc_opcodes) <bc-, bcl-, bca-, bcla-, bclr-, bclrl-, bcctr-,
bcctrl-, bctar-, bctarl->: Replace BOE with BOM.
(powerpc_opcodes) <bc+, bcl+, bca+, bcla+, bclr+, bclrl+, bcctr+,
bcctrl+, bctar+, bctarl+>: Replace BOE with BOP.
<bdnztar, bdnztarl, bdztar, bdztarl, btar, btarl, bdnztar-, bdnztarl-,
bdnztar+, bdnztarl+, bdztar-, bdztarl-, bdztar+, bdztarl+, bgetar,
bnltar, bgetarl, bnltarl, bletar, bngtar, bletarl, bngtarl, bnetar,
bnetarl, bnstar, bnutar, bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-,
bnltarl-, bletar-, bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-,
bnstar-, bnutar-, bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+,
bnltarl+, bletar+, bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+,
bnstar+, bnutar+, bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl,
beqtar, beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-,
bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-,
buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+,
bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar,
bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar,
bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+,
bttarl+>: New extended mnemonics.
gas/
PR gas/24349
* testsuite/gas/ppc/power8.s: (bdnztar, bdnztarl, bdztar, bdztarl,
btar, btarl, bdnztar-, bdnztarl-, bdnztar+, bdnztarl+, bdztar-,
bdztarl-, bdztar+, bdztarl+, bgetar, bnltar, bgetarl, bnltarl,
bletar, bngtar, bletarl, bngtarl, bnetar, bnetarl, bnstar, bnutar,
bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-, bnltarl-, bletar-,
bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-, bnstar-, bnutar-,
bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+, bnltarl+, bletar+,
bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+, bnstar+, bnutar+,
bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl, beqtar,
beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-,
bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-,
buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+,
bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar,
bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar,
bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+,
bttarl+): Add tests of extended mnemonics.
* testsuite/gas/ppc/power8.d: Likewise. Update previous bctar tests
to expect new extended mnemonics.
* testsuite/gas/ppc/a2.s: <bc, bc-, bc+, bcl, bcl-, bcl+>: Update test
to not use illegal BO value. Use a more convenient BI value.
* testsuite/gas/ppc/a2.d: Update tests for new expect output.
Thomas Schwinge [Thu, 4 Apr 2019 09:20:09 +0000 (11:20 +0200)]
[GDB, Hurd] Fix build; 'target_waitstatus_to_string' call
Recent commit
c29705b71a8ec966478c0dc4712194a95291c6de removed an incomplete
local implementation in favor of 'target_waitstatus_to_string' (thanks!), but
introduced a small typing error:
In file included from [...]/gdb/gnu-nat.c:24:0:
[...]/gdb/gnu-nat.c: In member function 'virtual ptid_t gnu_nat_target::wait(ptid_t, target_waitstatus*, int)':
[...]/gdb/gnu-nat.c:1652:43: error: cannot convert 'target_waitstatus**' to 'const target_waitstatus*' for argument '1' to 'std::__cxx11::string target_waitstatus_to_string(const target_waitstatus*)'
target_waitstatus_to_string (&status).c_str ());
^
[...]/gdb/gnu-nat.h:119:32: note: in definition of macro 'debug'
__FILE__ , __LINE__ , ##args); } while (0)
^~~~
[...]/gdb/gnu-nat.c:1650:3: note: in expansion of macro 'inf_debug'
inf_debug (inf, "returning ptid = %s, %s",
^~~~~~~~~
gdb/
* gnu-nat.c (gnu_nat_target::wait): Fix
target_waitstatus_to_string call.
GDB Administrator [Thu, 4 Apr 2019 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
Max Filippov [Tue, 2 Apr 2019 21:32:42 +0000 (14:32 -0700)]
gas: use literals/const16 for xtensa loop relaxation
Loop opcode relaxation that uses addi/addmi doesn't work well with other
relaxations that may cause code movement. Instead of encoding fixed loop
end offset in the relaxed sequence use l32r or a pair of const16 to load
loop end address. This way the address of the loop end gets a relocation
record and it gets updated appropriately.
gas/
2019-04-03 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (convert_frag_immed): Drop
convert_frag_immed_finish_loop invocation.
(convert_frag_immed_finish_loop): Drop declaration and
definition.
* config/xtensa-relax.c (widen_spec_list): Replace loop
widening that uses addi/addmi with widening that uses l32r
and const16.
Alan Modra [Wed, 3 Apr 2019 00:51:36 +0000 (11:21 +1030)]
PR24411, Division is not accepted in MEMORY length expression
Let's hope no one has section names starting with '/' in scripts. If
they do, this change to fix parsing of '/' in expressiongs will break
their project.
PR 24411
ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
(<EXPRESSION>"/DISCARD/"): New.
Alan Modra [Wed, 3 Apr 2019 00:58:17 +0000 (11:28 +1030)]
ldlex.l tidy
Underscore was specified twice in all these patterns, and backslash
twice in some. Flex warned about the $SYSROOT rule, which is covered
by earlier rules: "ldlex.l:386: warning, rule cannot be matched".
* ldlex.l: Formatting.
(CMDFILENAMECHAR, CMDFILENAMECHAR1): Delete.
(FILENAMECHAR1, SYMBOLNAMECHAR1, FILENAMECHAR, WILDCHAR),
(NOCFILENAMECHAR): Remove duplicate chars. Reorder.
(SYMBOLCHARN): Likewise. Rename to SYMBOLNAMECHAR.
(<INPUTLIST>"$SYSROOT"..): Delete rule.
Alan Modra [Tue, 2 Apr 2019 06:08:20 +0000 (16:38 +1030)]
BFD whitespace fixes
* coff-i386.c, * coff-x86_64.c, * coffgen.c, * dwarf2.c,
* elf-m10200.c, * elf.c, * elf32-arm.c, * elf32-bfin.c,
* elf32-csky.c, * elf32-m32r.c, * elf32-microblaze.c, * elf32-pru.c,
* elf32-rx.c, * elf32-xgate.c, * elf64-sparc.c, * elfnn-ia64.c,
* elfxx-riscv.c, * elfxx-sparc.c, * linker.c, * mach-o.c,
* pe-x86_64.c, * pei-x86_64.c, * plugin.c: Whitespace fixes.
GDB Administrator [Wed, 3 Apr 2019 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Tue, 2 Apr 2019 20:30:07 +0000 (13:30 -0700)]
RISC-V: Don't check ABI flags if no code section.
This fixes a glib build failure reported in PR 24389. Using ld -b binary
creates an object file with no elf header flags set which has the wrong ABI
info for riscv64-linux. But the file also has no code sections, so I added
code borrowed from the arm port that only checks the ELF header ABI flags if
there is a code section.
bfd/
PR 24389
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of
ELF header flags to after check for ELF object file. Loop through
sections looking for code sections, if none, then skip ABI checks.
GDB Administrator [Tue, 2 Apr 2019 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Thu, 14 Feb 2019 15:49:39 +0000 (15:49 +0000)]
gdb/fortran: Handle internal function calls
If an convenience function is defined in python (or guile), then
currently this will not work in Fortran, instead the user is given
this message:
(gdb) set language fortran
(gdb) p $myfunc (3)
Cannot perform substring on this type
Compare this to C:
(gdb) set language c
(gdb) p $myfunc (3)
$1 = 1
After this patch we see the same behaviour in both C and Fortran.
I've extended the test to check that all languages can call the
convenience functions - only Fortran was broken.
When calling convenience functions in Fortran we don't need to perform
the same value preparation (passing by pointer) that we would for
calling a native function - passing the real value is fine.
gdb/ChangeLog:
* eval.c (evaluate_subexp_standard): Handle internal functions
during Fortran function call handling.
gdb/testsuite/ChangeLog:
* gdb.python/py-function.exp: Check calling helper function from
all languages.
* lib/gdb.exp (gdb_supported_languages): New proc.
Andrew Burgess [Thu, 14 Mar 2019 13:58:58 +0000 (13:58 +0000)]
gdb: Add $_cimag and $_creal internal functions
Add two new internal functions $_cimag and $_creal that extract the
imaginary and real parts of a complex value.
These internal functions can take a complex value of any type 'float
complex', 'double complex', or 'long double complex' and return a
suitable floating point value 'float', 'double', or 'long double'.
So we can now do this:
(gdb) p z1
$1 = 1.5 + 4.5 * I
(gdb) p $_cimag (z1)
$4 = 4.5
(gdb) p $_creal (z1)
$4 = 1.5
The components of a complex value are not strictly named types in
DWARF, as the complex type is itself the base type. However, once we
are able to extract the components it makes sense to be able to ask
what the type of these components is and get a sensible answer back,
rather than the error we would currently get. Currently GDB says:
(gdb) ptype z1
type = complex double
(gdb) p $_cimag (z1)
$4 = 4.5
(gdb) ptype $
type = <invalid type code 9>
With the changes in dwarf2read.c, GDB now says:
(gdb) ptype z1
type = complex double
(gdb) p $_cimag (z1)
$4 = 4.5
(gdb) ptype $
type = double
Which seems to make more sense.
gdb/ChangeLog:
* NEWS: Mention new internal functions.
* dwarf2read.c (dwarf2_init_complex_target_type): New function.
(read_base_type): Use dwarf2_init_complex_target_type.
* value.c (creal_internal_fn): New function.
(cimag_internal_fn): New function.
(_initialize_values): Register new internal functions.
gdb/doc/ChangeLog:
* gdb.texinfo (Convenience Funs): Document '$_creal' and
'$_cimag'.
gdb/testsuite/ChangeLog:
* gdb.base/complex-parts.c: New file.
* gdb.base/complex-parts.exp: New file.
Philippe Waroquiers [Sun, 24 Mar 2019 14:14:55 +0000 (15:14 +0100)]
Fix internal error and improve 'set debug infrun 1'/target wait kind trace
The test gdb.threads/watchthreads-reorder.exp verifies that the
'set debug infrun 1' debug output does not crash GDB.
Under high load, the test can still cause a GDB internal error (see details
below).
This patch fixes this crash, and improves/factorises some wait kind traces.
Tested on debian/amd64 + run one test with 'set debug infrun 1'.
Changes compared to the first version:
* Handles the suggestions of Kevin to trace the relevant elements
of the wait status (this is done by calling target_waitstatus_to_string).
* Some other changes to factorise wait status tracing.
Note that using target_waitstatus_to_string instead of the 'locally printed'
status kind strings means that debug trace that was using strings such as:
"EXITED" or "TARGET_WAITKIND_EXITED"
will now use what is printed by target_waitstatus_to_string e.g.
"exited".
gdb/ChangeLog
2019-04-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* infrun.c (stop_all_threads): If debug_infrun, always
trace the wait status after wait_one, using
target_waitstatus_to_string and target_pid_to_str.
(handle_inferior_event): Replace various trace of
wait status kind by a single trace.
* gdb/gnu-nat.c (gnu_nat_target::wait): Replace local
wait status kind image by target_waitstatus_to_string.
* target/waitstatus.c (target_waitstatus_to_string): Fix
obsolete comment.
(top-gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f3d54a0642a in __GI_abort () at abort.c:89
#2 0x0000555c24c60e66 in dump_core () at ../../fixleaks/gdb/utils.c:201
#3 0x0000555c24c63d49 in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=problem@entry=0x555c25338d40 <internal_error_problem>, file=<optimized out>, line=287,
fmt=<optimized out>, ap=<optimized out>) at ../../fixleaks/gdb/utils.c:411
#4 0x0000555c24c63eab in internal_verror (file=<optimized out>, line=<optimized out>, fmt=<optimized out>,
ap=<optimized out>) at ../../fixleaks/gdb/utils.c:436
#5 0x0000555c249e8c22 in internal_error (file=file@entry=0x555c24e0f2ad "../../fixleaks/gdb/inferior.c",
line=line@entry=287, fmt=<optimized out>) at ../../fixleaks/gdb/common/errors.c:55
#6 0x0000555c247d3f5c in find_inferior_pid (pid=<optimized out>) at ../../fixleaks/gdb/inferior.c:287
#7 0x0000555c24ad2248 in find_inferior_pid (pid=<optimized out>) at ../../fixleaks/gdb/inferior.c:302
#8 find_inferior_ptid (ptid=...) at ../../fixleaks/gdb/inferior.c:301
#9 0x0000555c24c35f25 in find_thread_ptid (ptid=...) at ../../fixleaks/gdb/thread.c:522
#10 0x0000555c24b0ab4d in thread_db_target::pid_to_str[abi:cxx11](ptid_t) (
this=0x555c2532e3e0 <the_thread_db_target>, ptid=...) at ../../fixleaks/gdb/linux-thread-db.c:1637
#11 0x0000555c24c2f420 in target_pid_to_str[abi:cxx11](ptid_t) (ptid=...) at ../../fixleaks/gdb/target.c:2083
#12 0x0000555c24ad9cab in stop_all_threads () at ../../fixleaks/gdb/infrun.c:4373
#13 0x0000555c24ada00f in stop_waiting (ecs=<optimized out>) at ../../fixleaks/gdb/infrun.c:7464
#14 0x0000555c24adc401 in process_event_stop_test (ecs=ecs@entry=0x7ffc9402d9d0) at ../../fixleaks/gdb/infrun.c:6181
...
(top-gdb) fr 12
#12 0x0000555c24ad9cab in stop_all_threads () at ../../fixleaks/gdb/infrun.c:4373
(top-gdb) p event_ptid
$5 = {m_pid = 25419, m_lwp = 25427, m_tid = 0}
(top-gdb) p ptid
$6 = {m_pid = 0, m_lwp = 0, m_tid = 0}
(top-gdb) p ws
$7 = {kind = TARGET_WAITKIND_THREAD_EXITED, value = {integer = 0, sig = GDB_SIGNAL_0, related_pid = {m_pid = 0,
m_lwp = 0, m_tid = 0}, execd_pathname = 0x0, syscall_number = 0}}
(top-gdb)
The gdb.log corresponding to the above crash is:
(gdb) PASS: gdb.threads/watchthreads-reorder.exp: reorder1: set debug infrun 1
continue
Continuing.
infrun: clear_proceed_status_thread (Thread 0x7ffff7fcfb40 (LWP 25419))
infrun: clear_proceed_status_thread (Thread 0x7ffff7310700 (LWP 25427))
infrun: clear_proceed_status_thread (Thread 0x7ffff6b0f700 (LWP 25428))
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: proceed: resuming Thread 0x7ffff7fcfb40 (LWP 25419)
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcfb40 (LWP 25419)] at 0x7ffff7344317
infrun: infrun_async(1)
infrun: prepare_to_wait
infrun: proceed: resuming Thread 0x7ffff7310700 (LWP 25427)
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7310700 (LWP 25427)] at 0x5555555553d7
infrun: prepare_to_wait
infrun: proceed: resuming Thread 0x7ffff6b0f700 (LWP 25428)
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff6b0f700 (LWP 25428)] at 0x5555555554c8
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Joining the threads.
[Thread 0x7ffff6b0f700 (LWP 25428) exited]
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 25419.25419.0 [Thread 0x7ffff7fcfb40 (LWP 25419)],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x555555555e50
infrun: context switch
infrun: Switching context from Thread 0x7ffff6b0f700 (LWP 25428) to Thread 0x7ffff7fcfb40 (LWP 25419)
infrun: BPSTAT_WHAT_STOP_NOISY
infrun: stop_waiting
infrun: stop_all_threads
infrun: stop_all_threads, pass=0, iterations=0
infrun: Thread 0x7ffff7fcfb40 (LWP 25419) not executing
infrun: Thread 0x7ffff7310700 (LWP 25427) executing, need stop
[Thread 0x7ffff7310700 (LWP 25427) exited]
infrun: target_wait (-1.0.0, status) =
infrun: 25419.25427.0 [LWP 25427],
infrun: status->kind = thread exited, status = 0
infrun: infrun_async(0)
../../fixleaks/gdb/inferior.c:287: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue to breakpoint: break-at-exit (GDB internal error)
Resyncing due to internal error.
n
infrun: infrun_async(1)
This is a bug, please report it. For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
infrun: infrun_async(0)
../../fixleaks/gdb/inferior.c:287: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Tom Tromey [Wed, 27 Mar 2019 19:21:24 +0000 (13:21 -0600)]
Handle DW_AT_ranges when reading partial symtabs
add_partial_subprogram does not handle DW_AT_ranges, while the full
symtab reader does. This can lead to discrepancies where a function
is not put into a partial symtab, and so is not available to "break"
and the like -- but is available if the full symtab has somehow been
read.
This patch fixes the bug by arranging to read DW_AT_ranges when
reading partial DIEs.
This is PR symtab/23331.
The new test case is derived from dw2-ranges-func.exp, which is why I
kept the copyright dates.
gdb/ChangeLog
2019-04-01 Tom Tromey <tromey@adacore.com>
PR symtab/23331:
* dwarf2read.c (partial_die_info::read): Handle DW_AT_ranges.
gdb/testsuite/ChangeLog
2019-04-01 Tom Tromey <tromey@adacore.com>
PR symtab/23331:
* gdb.dwarf2/dw2-ranges-main.c: New file.
* gdb.dwarf2/dw2-ranges-psym.c: New file.
* gdb.dwarf2/dw2-ranges-psym.exp: New file.
Sergio Durigan Junior [Fri, 29 Mar 2019 21:34:54 +0000 (17:34 -0400)]
Destroy allocated values when exiting GDB
When the user exits GDB, we might still have some allocated values in
the chain, which, in specific scenarios, can cause problems when GDB
attempts to destroy them in "quit_force". For example, see the bug
reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=1690120
And the thread starting at:
https://sourceware.org/ml/gdb-patches/2019-03/msg00475.html
Message-ID: <87r2azkhmq.fsf@redhat.com>
In order to avoid that, and to be more aware of our allocated
resources, this commit implements a new function "finalize_values" and
calls it from inside "quit_force".
Tested by the BuildBot.
2019-04-01 Sergio Durigan Junior <sergiodj@redhat.com>
Pedro Alves <palves@redhat.com>
* top.c (quit_force): Call 'finalize_values'.
* value.c (finalize_values): New function.
* value.h (finalize_values): Declare.
Andre Vieira [Mon, 1 Apr 2019 09:43:32 +0000 (10:43 +0100)]
[GAS, Arm] CLI with architecture sensitive extensions
This patch adds a new framework to add architecture sensitive extensions, like
GCC does. This patch also implements all architecture extensions currently
available in GCC.
This framework works as follows. To enable architecture sensitive extensions
for a particular architecture, that architecture must contain an ARM_ARCH_OPT2
entry in the 'arm_archs' table. All fields here are the same as previous, with
the addition of a new extra field at the end to <name> it's extension table.
This <name>, corresponds to a <name>_ext_table of type 'struct arm_ext_table'.
This struct can be filled with three types of entries:
ARM_ADD (string <ext>, arm_feature_set <enable_bits>), which means +<ext> will
enable <enable_bits>
ARM_REMOVE (string <ext>, arm_feature_set <disable_bits>), which means
+no<ext> will disable <disable_bits>
ARM_EXT (string <ext>, arm_feature_set <enable_bits>, arm_feature_set
<disable_bits>), which means +<ext> will enable <enable_bits> and +no<ext>
will disable <disable_bits> (this is to be used instead of adding an
ARM_ADD and ARM_REMOVE for the same <ext>)
This patch does not disable the use of the old extensions, even if some of them
are duplicated in the new tables. This is a "in-between-step" as we may want to
deprecate the old table of extensions in later patches. For now, GAS will first
look for the +<ext> or +no<ext> in the new table and if no entry is found it
will continue searching in the old table, following old behaviour. If only an
ARM_ADD or an ARM_REMOVE is defined for <ext> and +no<ext> or +<ext> resp. is
used then it also continues to search the old table for it.
A couple of caveats:
- This patch does not enable the use of these architecture extensions with the
'.arch_extension' directive. This is future work that I will tend to later.
- This patch does not enable the use of these architecture extensions with the
-mcpu option. This is future work that I will tend to later.
- This patch does not change the current behaviour when combining an
architecture extension and using -mfpu on the command-line. The current
behaviour of GAS is to stage the union of feature bits enabled by both -march
and -mfpu. GCC behaves differently here, so this is something we may want to
revisit on a later date.
Marco Barisione [Mon, 1 Apr 2019 07:59:53 +0000 (09:59 +0200)]
Add gdb.Value.format_string ()
The str () function, called on a gdb.Value instance, produces a string
representation similar to what can be achieved with the print command,
but it doesn't allow to specify additional formatting settings, for
instance disabling pretty printers.
This patch introduces a new format_string () method to gdb.Value which
allows specifying more formatting options, thus giving access to more
features provided by the internal C function common_val_print ().
gdb/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
Add gdb.Value.format_string ().
* python/py-value.c (copy_py_bool_obj):
(valpy_format_string): Add gdb.Value.format_string ().
* NEWS: Document the addition of gdb.Value.format_string ().
gdb/doc/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
* python.texi (Values From Inferior): Document
gdb.Value.format_string ().
gdb/testsuite/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
Test gdb.Value.format_string ().
* gdb.python/py-format-string.exp: New test.
* gdb.python/py-format-string.c: New file.
* gdb.python/py-format-string.py: New file.
Marco Barisione [Mon, 1 Apr 2019 07:43:54 +0000 (09:43 +0200)]
Add myself to gdb/MAINTAINERS
gdb/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
* MAINTAINERS (Write After Approval): Add Marco Barisione.