• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


users/palves/per_ui_repeat
RSS
Rev. Hora Autor
5f6d441 users/palves/per_ui_repeat 2017-11-07 22:04:42 Pedro Alves

show_commands

598364c 2017-11-07 21:49:41 Pedro Alves

x_command

5e772ff 2017-11-07 21:27:00 Pedro Alves

set_current_sal

bd16eda 2017-11-07 21:09:06 Pedro Alves

saved_command_line

a02b41a 2017-11-07 20:16:09 Pedro Alves

Add some more breakpoint/location range tests

Some extra thoroughness tests that I had over here.

gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>

* gdb.cp/ena-dis-br-range.exp: Add more tests.

95e95a6 2017-11-07 20:07:19 Pedro Alves

Make breakpoint/location number parsing error output consistent

... and also make GDB catch a few more cases of invalid input.

This fixes the inconsistency in GDB's output (e.g., "bad" vs "Bad")
exposed by the new tests added in the previous commit.

Also, makes the "0-0" and "inverted range" cases be loud errors.

Also makes GDB reject negative breakpoint number in ranges. We
already rejected negative number literals, but you could still subvert
that via convenience variables, like:

(gdb) set $bp -1
(gdb) disable $bp.1-2

The change to get_number_trailer fixes a bug exposed by the new tests.
The function did not handle parsing "-$num". [This wasn't visible in
the gdb.multi/tids.exp (which has similar tests) because the TID range
parsing is implemented differently.]

gdb/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>

* breakpoint.c (extract_bp_kind): New enum.
(extract_bp_num, extract_bp_or_bp_range): New functions, partially
factored out from ...
(extract_bp_number_and_location): ... here.
* cli/cli-utils.c (get_number_trailer): Handle '-$variable'.

gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>

* gdb.base/ena-dis-br.exp (test_ena_dis_br): Adjust test.
* gdb.cp/ena-dis-br-range.exp: Adjust tests.
(disable_invalid, disable_inverted, disable_negative): New
procedures.
("bad numbers"): New set of tests.

cee62db 2017-11-07 20:06:49 Pedro Alves

Add base 'enable/disable invalid location range' tests

This adds tests that exercise the "bad breakpoint number" paths.
Specifically:

- malformed ranges
- use of explicit 0 as bp/loc number.
- inverted ranges

I'm adding this as a baseline to improve. This shows that there's a
lot of inconsistency in GDB's output (e.g., "bad" vs "Bad").

Also, IMO, the "0-0" and inverted range cases should be loud errors.

That and more will all be addressed in the next patch.

gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>

* gdb.cp/ena-dis-br-range.exp: Add tests.

cc638e8 2017-11-07 20:06:00 Pedro Alves

Breakpoint location parsing: always error instead of warning

It's odd that when parsing a breakpoint or location number, we error out
in most cases, but warn in others.

(gdb) disable 1-
bad breakpoint number at or near: '1-'
(gdb) disable -1
bad breakpoint number at or near: '-1'
(gdb) disable .foo
bad breakpoint number at or near: '.foo'
(gdb) disable foo.1
Bad breakpoint number 'foo.1'
(gdb) disable 1.foo
warning: bad breakpoint number at or near '1.foo'

This changes GDB to always error out. It required touching one testcase
that expected the warning.

gdb/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>

* breakpoint.c (extract_bp_number_and_location): Change return
type to void. Throw error instead of warning.
(enable_disable_command): Adjust.

gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>

* gdb.base/ena-dis-br.exp: Don't expect "warning:".

d0fe470 2017-11-07 20:00:31 Xavier Roirand

Allow enabling/disabling breakpoint location ranges

When a breakpoint has multiple locations, like e.g.:

Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x080486a2 in void foo<int>()...
1.2 y 0x080486ca in void foo<double>()...
[....]
1.5 y 0x080487fa in void foo<long>()...

it's possible to enable/disable the individual locations using the
'<breakpoint_number>.<location_number>' syntax, like e.g.:

(gdb) disable 1.2 1.3 1.4 1.5

That's inconvenient when you have a long list of locations to disable,
however.

This patch adds shorthand for the above, by making it possible to
specify a range of locations with the following syntax (similar to
thread id ranges):

<breakpoint_number>.<first_location_number>-<last_location_number>

For example, the command above can now be simplified to:

(gdb) disable 1.2-5

gdb/ChangeLog:
2017-11-07 Xavier Roirand <roirand@adacore.com>
Pedro Alves <palves@redhat.com>

* breakpoint.c (map_breakpoint_number_range): New, factored out
from ...
(map_breakpoint_numbers): ... here.
(find_location_by_number): Change parameters from string to
breakpoint number and location.
(extract_bp_number_and_location): New function.
(enable_disable_bp_num_loc)
(enable_disable_breakpoint_location_range)
(enable_disable_command): New functions, factored out ...
(enable_command, disable_command): ... these functions, and
adjusted to support ranges.
* NEWS: Document enable/disable breakpoint location range feature.

gdb/doc/ChangeLog:
2017-11-07 Xavier Roirand <roirand@adacore.com>
Pedro Alves <palves@redhat.com>

* gdb.texinfo (Set Breaks): Document support for breakpoint
location ranges in the enable/disable commands.

gdb/testsuite/ChangeLog:
2017-11-07 Xavier Roirand <roirand@adacore.com>
Pedro Alves <palves@redhat.com>

* gdb.base/ena-dis-br.exp: Add reference to
gdb.cp/ena-dis-br-range.exp.
* gdb.cp/ena-dis-br-range.exp: New file.
* gdb.cp/ena-dis-br-range.cc: New file.

0198d5e 2017-11-07 19:17:21 Tamar Christina

This patch similarly to the AArch64 one enables Dot Product support by default for the Cortex-A55 and Cortex-A75 which have hardware support for these instructions.

gas * config/tc-arm.c (arm_cpus):
Change FPU_ARCH_CRYPTO_NEON_VFP_ARMV8
into FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_DOTPROD.

include * opcode/arm.h (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_DOTPROD):
New macro.

db84fff 2017-11-07 17:20:03 Alan Modra

PowerPC64 statistics message

Fixes "linker stubs in 1 groups".

* elf64-ppc.c (ppc64_elf_build_stubs): Correct pluralization in
statistics message.

e54e9ac 2017-11-07 15:31:17 Alan Modra

bundle_lock message tidy

I'd edited these thinking that there might be cases where the counts
were one, but on further investigation it appears not. What's left
here are some minor tweaks.

* read.c (assemble_one, s_bundle_unlock): Formatting.
Consistently add comma and "bytes" to error message.
* testsuite/gas/i386/bundle-bad.l: Adjust to suit.

d3a49aa 2017-11-07 15:31:16 Alan Modra

readelf ngettext fixes

This patch is a first pass at fixing readelf message pluralization.
I've deliberately not fixed the "out of memory" errors since it's very
unlikely that they will ever be complaining about not being able to
allocate for a single entry, and a few others where the size is very
unlikely to be 1 byte.

Then there are messages like this one:
"Out of %lu items there are %zu bucket clashes (longest of %zu entries).\n"
I suppose this could be split into three parts, "Of %lu items ",
"there are %zu bucket clashes ", and "(longest of %zu entries).\n",
each part being printed separately, but that might not be ideal for
sentence construction in other languages. For now I'm punting on this
one.

Changes to readelf output require lots of testsuite adjustment..

binutils/
* dwarf.c (read_uleb128): Properly pluralize messages.
(display_debug_lines_raw, display_debug_loc): Likewise.
(display_debug_names, process_cu_tu_index): Likewise.
* od-macho.c (dump_code_signature_superblob): Likewise.
* readelf.c (process_program_headers): Likewise.
(process_section_header, process_relocs): Likewise.
(hppa_process_unwind, arm_process_unwind): Likewise.
(process_dynamic_section, process_version_sections): Likewise.
(process_symbol_table, process_syminfo): Likewise.
(apply_relocations, process_mips_specific): Likewise.
(process_gnu_liblist, process_notes_at): Likewise.
(process_archive): Likewise.
* testsuite/binutils-all/dw2-1.W,
* testsuite/binutils-all/dw2-3.W,
* testsuite/binutils-all/dw2-3gabi.W,
* testsuite/binutils-all/dw5.S,
* testsuite/binutils-all/dw5.W,
* testsuite/binutils-all/i386/compressed-1a.d,
* testsuite/binutils-all/libdw2-compressedgabi.out,
* testsuite/binutils-all/objdump.W,
* testsuite/binutils-all/readelf.r,
* testsuite/binutils-all/readelf.r-64,
* testsuite/binutils-all/x86-64/compressed-1a.d: Update
for pluralization fixes.
gas/
* testsuite/gas/arm/got_prel.d,
* testsuite/gas/elf/dwarf2-1.d,
* testsuite/gas/elf/dwarf2-2.d,
* testsuite/gas/elf/dwarf2-3.d,
* testsuite/gas/elf/dwarf2-5.d,
* testsuite/gas/elf/dwarf2-6.d,
* testsuite/gas/i386/debug1.d,
* testsuite/gas/i386/dw2-compress-1.d,
* testsuite/gas/i386/dw2-compress-3a.d,
* testsuite/gas/i386/dw2-compress-3b.d,
* testsuite/gas/i386/dw2-compressed-1.d,
* testsuite/gas/i386/dw2-compressed-3a.d,
* testsuite/gas/i386/dw2-compressed-3b.d,
* testsuite/gas/i386/ilp32/x86-64-localpic.d,
* testsuite/gas/i386/localpic.d,
* testsuite/gas/i386/x86-64-localpic.d,
* testsuite/gas/ia64/pr13167.d,
* testsuite/gas/mips/loc-swap-2.d,
* testsuite/gas/mips/loc-swap.d,
* testsuite/gas/mips/micromips@loc-swap-2.d,
* testsuite/gas/mips/micromips@loc-swap.d,
* testsuite/gas/mips/mips16-dwarf2-n32.d,
* testsuite/gas/mips/mips16-dwarf2.d,
* testsuite/gas/mips/mips16@loc-swap-2.d,
* testsuite/gas/mips/mips16@loc-swap.d,
* testsuite/gas/mips/mips16e@loc-swap.d,
* testsuite/gas/mmix/bspec-1.d,
* testsuite/gas/mmix/bspec-2.d,
* testsuite/gas/tic6x/unwind-1.d,
* testsuite/gas/tic6x/unwind-2.d,
* testsuite/gas/tic6x/unwind-3.d: Update for pluralization
fixes.
ld/
* testsuite/ld-aarch64/ifunc-13.d,
* testsuite/ld-aarch64/ifunc-15.d,
* testsuite/ld-aarch64/ifunc-20.d,
* testsuite/ld-alpha/tlsbin.rd,
* testsuite/ld-alpha/tlspic.rd,
* testsuite/ld-arm/ifunc-3.rd,
* testsuite/ld-arm/ifunc-9.rd,
* testsuite/ld-arm/unwind-mix.d,
* testsuite/ld-arm/unwind-rel.d,
* testsuite/ld-cris/hiddef1.d,
* testsuite/ld-cris/libdso-13.d,
* testsuite/ld-cris/libdso-2.d,
* testsuite/ld-cris/pr16044.d,
* testsuite/ld-cris/tls-local-63.d,
* testsuite/ld-cris/tls-local-64.d,
* testsuite/ld-cris/tls-und-38.d,
* testsuite/ld-cris/tls-und-42.d,
* testsuite/ld-cris/tls-und-46.d,
* testsuite/ld-cris/tls-und-50.d,
* testsuite/ld-cris/weakref3.d,
* testsuite/ld-cris/weakref4.d,
* testsuite/ld-elf/comm-data2r.rd,
* testsuite/ld-elf/discard1.d,
* testsuite/ld-elf/discard2.d,
* testsuite/ld-elf/pr19539.d,
* testsuite/ld-elf/pr22374-1.r,
* testsuite/ld-elf/pr22374-2.r,
* testsuite/ld-i386/combreloc.d,
* testsuite/ld-i386/emit-relocs-nacl.rd,
* testsuite/ld-i386/emit-relocs.rd,
* testsuite/ld-i386/pr13302.d,
* testsuite/ld-i386/pr17709-nacl.rd,
* testsuite/ld-i386/pr17709.rd,
* testsuite/ld-i386/pr19539.d,
* testsuite/ld-i386/pr19615.d,
* testsuite/ld-i386/pr19636-1a.d,
* testsuite/ld-i386/pr19636-1e.d,
* testsuite/ld-i386/pr19636-1f.d,
* testsuite/ld-i386/pr19636-2a.d,
* testsuite/ld-i386/pr19636-2b.d,
* testsuite/ld-i386/pr19636-2d-nacl.d,
* testsuite/ld-i386/pr19636-2e-nacl.d,
* testsuite/ld-i386/pr19636-3a.d,
* testsuite/ld-i386/pr19636-3d.d,
* testsuite/ld-i386/pr19636-3e.d,
* testsuite/ld-i386/pr19636-4a.d,
* testsuite/ld-i386/pr19645.d,
* testsuite/ld-i386/pr19827-nacl.rd,
* testsuite/ld-i386/pr19827.rd,
* testsuite/ld-i386/pr20253-4a.d,
* testsuite/ld-i386/pr20253-4b.d,
* testsuite/ld-i386/pr20253-5.d,
* testsuite/ld-i386/tlsbin-nacl.rd,
* testsuite/ld-i386/tlsbin.rd,
* testsuite/ld-i386/tlspic-nacl.rd,
* testsuite/ld-i386/tlspic.rd,
* testsuite/ld-i386/undefweakb.d,
* testsuite/ld-ia64/tlsbin.rd,
* testsuite/ld-ia64/tlspic.rd,
* testsuite/ld-ifunc/ifunc-13-i386.d,
* testsuite/ld-ifunc/ifunc-13-x86-64.d,
* testsuite/ld-ifunc/ifunc-15-i386.d,
* testsuite/ld-ifunc/ifunc-15-x86-64.d,
* testsuite/ld-ifunc/ifunc-20-i386.d,
* testsuite/ld-ifunc/ifunc-20-x86-64.d,
* testsuite/ld-ifunc/ifunc-23a-x86.d,
* testsuite/ld-ifunc/ifunc-23b-x86.d,
* testsuite/ld-ifunc/ifunc-23c-x86.d,
* testsuite/ld-ifunc/ifunc-24a-x86.d,
* testsuite/ld-ifunc/ifunc-24b-x86.d,
* testsuite/ld-ifunc/ifunc-24c-x86.d,
* testsuite/ld-ifunc/ifunc-25a-x86.d,
* testsuite/ld-ifunc/ifunc-25b-x86.d,
* testsuite/ld-ifunc/ifunc-25c-x86.d,
* testsuite/ld-m68k/got-1.d,
* testsuite/ld-mips-elf/vxworks1.rd,
* testsuite/ld-powerpc/ambiguousv1.d,
* testsuite/ld-powerpc/ambiguousv1b.d,
* testsuite/ld-powerpc/ambiguousv2.d,
* testsuite/ld-powerpc/ambiguousv2b.d,
* testsuite/ld-powerpc/tlsexe.r,
* testsuite/ld-powerpc/tlsexe32.r,
* testsuite/ld-powerpc/tlsexetoc.r,
* testsuite/ld-powerpc/tlsso.r,
* testsuite/ld-powerpc/tlsso32.r,
* testsuite/ld-powerpc/tlstocso.r,
* testsuite/ld-powerpc/vle-multiseg-1.d,
* testsuite/ld-powerpc/vle-multiseg-2.d,
* testsuite/ld-powerpc/vle-multiseg-3.d,
* testsuite/ld-s390/tlsbin.rd,
* testsuite/ld-s390/tlsbin_64.rd,
* testsuite/ld-s390/tlspic.rd,
* testsuite/ld-s390/tlspic_64.rd,
* testsuite/ld-sh/ld-r-1.d,
* testsuite/ld-sh/sh64/gotplt.d,
* testsuite/ld-sh/shared-1.d,
* testsuite/ld-sh/tlsbin-2.d,
* testsuite/ld-sh/tlspic-2.d,
* testsuite/ld-sparc/gotop32.rd,
* testsuite/ld-sparc/gotop64.rd,
* testsuite/ld-sparc/tlssunpic32.rd,
* testsuite/ld-sparc/tlssunpic64.rd,
* testsuite/ld-sparc/vxworks1-lib.rd,
* testsuite/ld-tic6x/shlib-app-1.rd,
* testsuite/ld-tic6x/shlib-app-1b.rd,
* testsuite/ld-tic6x/shlib-app-1r.rd,
* testsuite/ld-tic6x/shlib-app-1rb.rd,
* testsuite/ld-tic6x/shlib-noindex.rd,
* testsuite/ld-vax-elf/export-class-data.rd,
* testsuite/ld-x86-64/pr13082-1a.d,
* testsuite/ld-x86-64/pr13082-1b.d,
* testsuite/ld-x86-64/pr13082-2a.d,
* testsuite/ld-x86-64/pr13082-2b.d,
* testsuite/ld-x86-64/pr13082-3a.d,
* testsuite/ld-x86-64/pr13082-3c.d,
* testsuite/ld-x86-64/pr13082-4a.d,
* testsuite/ld-x86-64/pr13082-5a.d,
* testsuite/ld-x86-64/pr13082-5b.d,
* testsuite/ld-x86-64/pr13082-6a.d,
* testsuite/ld-x86-64/pr13082-6b.d,
* testsuite/ld-x86-64/pr17709-nacl.rd,
* testsuite/ld-x86-64/pr17709.rd,
* testsuite/ld-x86-64/pr19539a.d,
* testsuite/ld-x86-64/pr19539b.d,
* testsuite/ld-x86-64/pr19615.d,
* testsuite/ld-x86-64/pr19636-1a.d,
* testsuite/ld-x86-64/pr19636-1d.d,
* testsuite/ld-x86-64/pr19636-1e.d,
* testsuite/ld-x86-64/pr19636-2a.d,
* testsuite/ld-x86-64/pr19636-2e.d,
* testsuite/ld-x86-64/pr19636-2f.d,
* testsuite/ld-x86-64/pr19636-3a.d,
* testsuite/ld-x86-64/pr19645.d,
* testsuite/ld-x86-64/pr19807-2b.d,
* testsuite/ld-x86-64/pr19807-2d.d,
* testsuite/ld-x86-64/pr19827-nacl.rd,
* testsuite/ld-x86-64/pr19827.rd,
* testsuite/ld-x86-64/pr20253-4a.d,
* testsuite/ld-x86-64/pr20253-4b.d,
* testsuite/ld-x86-64/pr20253-4d.d,
* testsuite/ld-x86-64/pr20253-4e.d,
* testsuite/ld-x86-64/pr20253-5a.d,
* testsuite/ld-x86-64/pr20253-5b.d,
* testsuite/ld-x86-64/tlsbin-nacl.rd,
* testsuite/ld-x86-64/tlsbin.rd,
* testsuite/ld-x86-64/tlspic-nacl.rd,
* testsuite/ld-x86-64/tlspic.rd,
* testsuite/ld-x86-64/tlspic2-nacl.rd: Update for
pluralization fixes.

992a06e 2017-11-07 15:30:37 Alan Modra

gas and ld pluralization fixes

gas/
* as.c (main): Properly pluralize messages.
* frags.c (frag_grow): Likewise.
* read.c (emit_expr_with_reloc, emit_expr_fix): Likewise.
(parse_bitfield_cons): Likewise.
* write.c (fixup_segment, compress_debug, write_contents): Likewise.
(relax_segment): Likewise.
* config/tc-arm.c (s_arm_elf_cons): Likewise.
* config/tc-cr16.c (l_cons): Likewise.
* config/tc-i370.c (i370_elf_cons): Likewise.
* config/tc-m68k.c (m68k_elf_cons): Likewise.
* config/tc-msp430.c (msp430_operands): Likewise.
* config/tc-s390.c (s390_elf_cons, s390_literals): Likewise.
* config/tc-mcore.c (md_apply_fix): Likewise.
* config/tc-tic54x.c (md_assemble): Likewise.
* config/tc-xtensa.c (xtensa_elf_cons): Likewise.
(xg_expand_assembly_insn): Likewise.
* config/xtensa-relax.c (build_transition): Likewise.
ld/
* ldlang.c (lang_size_sections_1): Properly pluralize messages.
(lang_check_section_addresses): Likewise.

f3ce9b3 2017-11-07 14:26:44 Alan Modra

Require ngettext in test of system gettext implementation

If binutils is going to use ngettext, then we'd better arrange for
intl/ to be compiled if the system gettext lacks ngettext.

* configure.ac: Invole AM_GNU_GETTEXT with need_ngettext.
* configure: Regenerate.
* aclocal.m4: Regenerate.

6003e27 2017-11-07 14:22:52 Alan Modra

ngettext support

binutils has lacked proper pluralization of output messages for a long
time, for example, readelf will display information about a section
that "contains 1 entries" or "There are 1 section headers". Fixing
this properly requires us to use ngettext, because other languages
have different rules to English.

This patch defines macros for ngettext and friends to handle builds
with --disable-nls, and tidies the existing nls support. I've
redefined gettext rather than just defining "_" as dgettext in bfd and
opcodes in case someone wants to use gettext there (which might
conceivably happen with generated code).

bfd/
* sysdep.h: Formatting, comment fixes.
(gettext, ngettext): Redefine when ENABLE_NLS.
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
(_): Define using gettext.
(textdomain, bindtextdomain): Use safer "do nothing".
* hosts/alphavms.h (textdomain, bindtextdomain): Likewise.
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
opcodes/
* opintl.h: Formatting, comment fixes.
(gettext, ngettext): Redefine when ENABLE_NLS.
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
(_): Define using gettext.
(textdomain, bindtextdomain): Use safer "do nothing".
binutils/
* sysdep.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gas/
* asintl.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gold/
* system.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
ld/
* ld.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.

84d5321 2017-11-07 09:00:21 GDB Administrator

Automatic date update in version.in

635dc5b 2017-11-07 02:39:09 Luis Machado

Update my e-mail address.

gdb/ChangeLog:
2017-11-06 Luis Machado <luis.machado@linaro.org>

* MAINTAINERS (Write After Approval): Update my e-mail address.

556e5da 2017-11-07 01:59:13 Pedro Alves

Simplify child_terminal_inferior

The comment about Lynx in child_terminal_init reads a bit odd, since
it's not exactly clear what "This" in "This is for Lynx" is referring
to. Looking back in history makes it clearer. When the comment was
originally added, in commit 91ecc8efa9b9, back in 1994, the code
looked like this:

~~~
#ifdef PROCESS_GROUP_TYPE
#ifdef PIDGET
/* This is for Lynx, and should be cleaned up by having Lynx be
a separate debugging target with a version of
target_terminal_init_inferior which passes in the process
group to a generic routine which does all the work (and the
non-threaded child_terminal_init_inferior can just pass in
inferior_pid to the same routine). */
inferior_process_group = PIDGET (inferior_pid);
#else
inferior_process_group = inferior_pid;
#endif
#endif
~~~

So this looked like it was about when GDB was growing support for
multi-threading, and inferior_pid was still a single int for most
ports.

Eventually we got ptid_t, so the comment isn't really useful today.
Particularly more so since we no longer support Lynx as a GDB host.

The only caller left of child_terminal_init_with_pgrp is gnu-nat.c
(the Hurd), and that target uses fork-child, so when we reach
gnu_terminal_init after spawning a new child, the current inferior
must already have the PID set, and the child must be a process group
leader.

We can't add a 'getpgid(inf->pid) == inf->pid' assertion to
child_terminal_init though (like a previous version of this patch was
doing [1]), because child_terminal_init is also reached after
attaching to a process. If we did, the new
gdb.base/attach-non-pgrp-leader.exp test would fail, with:

(gdb) attach 12415
Attaching to program: build/gdb/testsuite/outputs/gdb.base/attach-non-pgrp-leader/attach-non-pgrp-leader, process 12415
src/gdb/inflow.c:180: internal-error: void child_terminal_init(target_ops*): Assertion `getpgid (inf->pid) == inf->pid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.base/attach-non-pgrp-leader.exp: child: attach to child (GDB internal error)

I'm not making GDB save the pgid for attached processes with getpgid
for now, because the saved process group affects other things which
I'm leaving for following patches, like e.g., the "interrupt" command.

[1] - https://sourceware.org/ml/gdb-patches/2017-11/msg00039.html

gdb/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* gnu-nat.c (gnu_terminal_init): Delete.
(gnu_target): Don't install gnu_terminal_init.
* inflow.c (child_terminal_init_with_pgrp): Delete, merged with ...
(child_terminal_init): ... this function.

46f67f8 2017-11-07 01:32:04 Pedro Alves

Test attaching to a process that isn't a process group leader

The patch at
<https://sourceware.org/ml/gdb-patches/2017-11/msg00039.html> was
proposing to add an assertion to child_terminal_init that turns out
would fail if you tried to attach to a process that isn't a process
group leader.

Since the testsuite failed to catch the problem, this commit adds a
new testcase that would catch it, like:

(gdb) attach 12415
Attaching to program: build/gdb/testsuite/outputs/gdb.base/attach-non-pgrp-leader/attach-non-pgrp-leader, process 12415
src/gdb/inflow.c:180: internal-error: void child_terminal_init(target_ops*): Assertion `getpgid (inf->pid) == inf->pid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.base/attach-non-pgrp-leader.exp: child: attach to child (GDB internal error)

gdb/testsuite/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* gdb.base/attach-non-pgrp-leader.c: New.
* gdb.base/attach-non-pgrp-leader.exp: New.

d192816 2017-11-07 01:19:12 Pedro Alves

Don't check termio.h and sgtty.h in common/common.m4 either

common/common.m4 still had checks for termio.h/sgtty.h that are stale
now. Remove them.

gdb/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* common/common.m4 (GDB_AC_COMMON): No longer check termio.h nor
sgtty.h.
* config.in, configure: Regenerate.

gdb/gdbserver/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* config.in, configure: Regenerate.

6aa899c 2017-11-07 01:13:05 Pedro Alves

Eliminate STOP_SIGNAL, use SIGTSTP directly

The STOP_SIGNAL macro was originally added for Convex Unix
(https://en.wikipedia.org/wiki/Convex_Computer).

In:

git show 7a67dd45ca1c:gdb/m-convex.h

we see:

~~~
/* Use SIGCONT rather than SIGTSTP because convex Unix occasionally
turkeys SIGTSTP. I think. */

#define STOP_SIGNAL SIGCONT
~~~

That's gdb-3.5, 1990... In gdb/ChangeLog-3.x we see:

~~~
Tue Apr 18 13:43:37 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)

Various changes involved in 1) getting gdb to work on the convex,
[...]
Made whatever signal indicates a stop configurable (via macro
STOP_SIGNAL).
(main): Setup use of above as a signal handler. Added check for
"-nw" in args already processed.
(command_line_input): SIGTSTP ==>STOP_SIGNAL.
~~~

Support for Convex Unix is long gone, and nothing else overrides
STOP_SIGNAL. So just use SIGTSTP directly, removing a little
obfuscation.

(I don't really understand why we override [1] readline's SIGTSTP
handler (only) when reading scripts (and then fail to restore it
properly, assuming SIG_DFL...), but I'll leave that for another pass.

[1] - Actually, starting with readline 6.3, readline is no longer
installing its handlers while GDB is in control...)

gdb/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* event-top.c: Check SIGTSTP instead of STOP_SIGNAL thoughout.
(async_init_signals): Adjust.
(handle_stop_sig): Rename to ...
(handle_sigtstp): ... this.
(async_stop_sig): Rename to ...
(async_sigtstp_handler): ... this, and delete STOP_SIGNAL !=
SIGTSTP path.
* event-top.h: Move signal.h include to the top. Check SIGTSTP
instead of STOP_SIGNAL thoughout.
(handle_stop_sig): Rename to ...
(handle_sigtstp): ... this.
* top.c (command_line_input): Replace STOP_SIGNAL -> SIGTSTP.

a94799a 2017-11-07 01:12:25 Pedro Alves

Don't set terminal flags twice in a row

I find this odd 'set flags twice' ancient code and comment annoyingly
distracting. It may well be that the reason for the double-set was
simply a copy/paste mistake, and that we've been doing this for
decades [1] for no good reason. Let's just get rid of it, and if we
find a real reason, add it back with a comment explaining why it's
necessary.

[1] This double-set was already in gdb 2.4 / 1988, the oldest release
we have sources for, and imported in git. From 'git show 7b4ac7e1ed2c
inflow.c':

+void
+terminal_inferior ()
+{
+ if (terminal_is_ours) /* && inferior_thisrun_terminal == 0) */
+ {
+ fcntl (0, F_SETFL, tflags_inferior);
+ fcntl (0, F_SETFL, tflags_inferior);

The "is there a reason" comment was added in 1993, by:

commit a88797b5eadf31e21804bc820429028bf708fbcd
Author: Fred Fish <fnf@specifix.com>
AuthorDate: Thu Aug 5 01:33:45 1993 +0000

gdb/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* inflow.c (child_terminal_inferior, child_terminal_ours_1): No
longer set flags twice in row.

726e135 2017-11-07 00:36:46 Pedro Alves

Assume termios is available, remove support for termio and sgtty

This commit garbage collects the termio and sgtty support.

GDB's terminal handling code still has support for the old termio and
sgtty interfaces in addition to termios. However, I think it's pretty
safe to assume that for a long, long time, Unix-like systems provide
termios. GNU/Linux, Solaris, Cygwin, AIX, DJGPP, macOS and the BSDs
all have had termios.h for many years. Looking around the web, I
found discussions about FreeBSD folks trying to get rid of old sgtty.h
a decade ago:

https://lists.freebsd.org/pipermail/freebsd-hackers/2007-March/019983.html

So I think support for termio and sgtty in GDB is just dead code that
is never compiled anywhere and is just getting in the way. For
example, serial_noflush_set_tty_state and the raw<->cooked concerns
mentioned in inflow.c only exist because of sgtty (see
hardwire_noflush_set_tty_state).

Regtested on GNU/Linux.

Confirmed that I can still build Solaris, DJGPP and AIX GDB and that
the resulting GDBs still include the termios.h-guarded code.
Confirmed mingw-w64 GDB still builds and skips the termios.h-guarded
code.

gdb/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* Makefile.in (SER_HARDWIRE): Update comment.
(HFILES_NO_SRCDIR): Remove gdb_termios.h.
* common/gdb_termios.h: Delete file.
* common/job-control.c: Include termios.h and unistd.h instead of
gdb_termios.h.
(gdb_setpgid): Remove HAVE_TERMIOS || TIOCGPGRP preprocessor
check.
(have_job_control): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
Remove sgtty code.
* configure.ac: No longer check for termio.h and sgtty.h.
* configure: Regenerate.
* inflow.c: Include termios.h instead of gdb_termios.h. Replace
PROCESS_GROUP_TYPE checks with HAVE_TERMIOS_H checks throughout.
Replace PROCESS_GROUP_TYPE references with pid_t references
throughout.
(gdb_getpgrp): Delete.
(set_initial_gdb_ttystate): Use tcgetpgrp instead of gdb_getpgrp.
(child_terminal_inferior): Remove comment. Remove sgtty code.
(child_terminal_ours_1): Use tcgetpgrp directly instead of
gdb_getpgrp. Use serial_set_tty_state instead aof
serial_noflush_set_tty_state. Remove sgtty code.
* inflow.h: Include unistd.h instead of gdb_termios.h. Replace
PROCESS_GROUP_TYPE check with HAVE_TERMIOS_H check.
(inferior_process_group): Now returns pid_t.
* ser-base.c (ser_base_noflush_set_tty_state): Delete.
* ser-base.h (ser_base_noflush_set_tty_state): Delete.
* ser-event.c (serial_event_ops): Update.
* ser-go32.c (dos_noflush_set_tty_state): Delete.
(dos_ops): Update.
* ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): Update.
* ser-pipe.c (pipe_ops): Update.
* ser-tcp.c (tcp_ops): Update.
* ser-unix.c: Include termios.h instead of gdb_termios.h. Remove
HAVE_TERMIOS checks.
[HAVE_TERMIO] (struct hardwire_ttystate): Delete.
[HAVE_SGTTY] (struct hardwire_ttystate): Delete.
(get_tty_state, set_tty_state): Drop termio and sgtty code, and
assume termios.
(hardwire_noflush_set_tty_state): Delete.
(hardwire_print_tty_state, hardwire_drain_output)
(hardwire_flush_output, hardwire_flush_input)
(hardwire_send_break, hardwire_raw, hardwire_setbaudrate)
(hardwire_setstopbits, hardwire_setparity): Drop termio and sgtty
code, and assume termios.
(hardwire_ops): Update.
(_initialize_ser_hardwire): Remove HAVE_TERMIOS check.
* serial.c (serial_noflush_set_tty_state): Delete.
* serial.h (serial_noflush_set_tty_state): Delete.
(serial_ops::noflush_set_tty_state): Delete.

gdb/gdbserver/ChangeLog:
2017-11-06 Pedro Alves <palves@redhat.com>

* configure.ac: No longer check for termio.h and sgtty.h.
* configure: Regenerate.
* remote-utils.c: Include termios.h instead of gdb_termios.h.
(remote_open): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
Remove termio and sgtty code.

1cfb73d 2017-11-07 00:04:03 Ulrich Weigand

Target FP: Merge doublest.c and dfp.c into target-float.c

Now that all target FP operations are performed via target-float.c,
this file remains the sole caller of functions in doublest.c and dfp.c.
Therefore, this patch merges the latter files into the former and
makes all their function static there.

gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>

* Makefile.in (SFILES): Remove doublest.c and dfp.c.
(HFILES_NO_SRCDIR): Remove doublest.h and dfp.h.
(COMMON_OBS): Remove doublest.o and dfp.o.
Do not build target-float.c (instead of doublest.c)
with -Wformat-nonliteral.

* doublest.c: Remove file.
* doublest.h: Remove file.
* dfp.c: Remove file.
* dfp.h: Remove file.

* target-float.c: Do not include "doublest.h" and "dfp.h".
(DOUBLEST): Move here from doublest.h.
(enum float_kind): Likewise.
(FLOATFORMAT_CHAR_BIT): Likewise.
(FLOATFORMAT_LARGEST_BYTES): Likewise.
(floatformat_totalsize_bytes): Move here from doublest.c. Make static.
(floatformat_precision): Likewise.
(floatformat_normalize_byteorder, get_field, put_field): Likewise.
(floatformat_is_negative, floatformat_classify, floatformat_mantissa):
Likewise.
(host_float_format, host_double_format, host_long_double_format):
Likewise.
(floatformat_to_string, floatformat_from_string): Likewise.
(floatformat_to_doublest): Likewise. Also, inline the original
convert_floatformat_to_doublest.
(floatformat_from_doublest): Likewise. Also, inline the original
convert_floatformat_from_doublest.

Include "dpd/decimal128.h", "dpd/decimal64.h", and "dpd/decimal32.h".
(MAX_DECIMAL_STRING): Move here from dfp.c.
(match_endianness): Likewise.
(set_decnumber_context, decimal_check_errors): Likewise.
(decimal_from_number, decimal_to_number): Likewise.
(decimal_to_string, decimal_from_string): Likewise. Make static.
(decimal_from_longest, decimal_from_ulongest): Likewise.
(decimal_to_longest): Likewise.
(decimal_binop, decimal_is_zero, decimal_compare): Likewise.
(decimal_convert): Likewise.

b07e9c4 2017-11-07 00:02:33 Ulrich Weigand

Target FP: Remove unused floating-point routines

This patch removes the following routines, which now have no remaining
users in GDB:
- extract_typed_floating
- store_typed_floating
- convert_typed_floating
- decimal_from_doublest
- decimal_to_doublest
- value_as_double
- unpack_double
- value_from_double
- value_from_decfloat

This completes removal of DOUBLEST from all files except doublest.{c,h}
and target-float.c.

gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>

* doublest.c: Do not include "gdbtypes.h".
(extract_typed_floating): Remove.
(store_typed_floating): Remove.
(convert_typed_floating): Remove.
* doublest.h (struct type): Remove.
(DOUBLEST_PRINT_FORMAT): Remove.
(DOUBLEST_SCAN_FORMAT): Remove.
(extract_typed_floating): Remove.
(store_typed_floating): Remove.
(convert_typed_floating): Remove.

* dfp.c (decimal_from_doublest): Remove.
(decimal_to_doublest): Remove.
* dfp.h: Do not include "doublest.h".
(decimal_from_doublest): Remove.
(decimal_to_doublest): Remove.

* value.c: Do not include "doublest.h" and "dfp.h".
(value_as_double): Remove.
(unpack_double): Remove.
(value_from_double): Remove.
(value_from_decfloat): Remove.
* value.h: Do not include "doublest.h".
(value_as_double): Remove.
(unpack_double): Remove.
(value_from_double): Remove.
(value_from_decfloat): Remove.

3b2ca82 2017-11-07 00:01:37 Ulrich Weigand

Target FP: Remove convert_typed_floating from tdep files

This patch mechanically replaces convert_typed_floating with the
equivalent target_float_convert throughout tdep files, to prepare
for the removal of doublest.{c,h}.

No functional change intended.

gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>

* i386-tdep.c: Include "target-float.h". Do not include "doublest.h".
(i386_extract_return_value): Use target_float_convert.
(i386_store_return_value): Likewise.
* i387-tdep.c (i387_register_to_value): Use target_float_convert.
(i387_value_to_register): Likewise.
* ia64-tdep.c: Include "target-float.h". Do not include "doublest.h".
(ia64_register_to_value): Use target_float_convert.
(ia64_value_to_register): Likewise.
(ia64_extract_return_value): Likewise.
(ia64_store_return_value): Likewise.
(ia64_push_dummy_call): Likewise.
* m68k-tdep.c: Include "target-float.h".
(m68k_register_to_value): Use target_float_convert.
(m68k_value_to_register): Likewise.
(m68k_svr4_extract_return_value): Likewise.
(m68k_svr4_store_return_value): Likewise.
* ppc-sysv-tdep.c: Include "target-float.h".
(ppc_sysv_abi_push_dummy_call): Use target_float_convert.
(do_ppc_sysv_return_value): Likewise.
(ppc64_sysv_abi_push_freg): Likewise.
(ppc64_sysv_abi_return_value_base): Likewise.
* rs6000-aix-tdep.c: Include "target-float.h".
(rs6000_push_dummy_call): Use target_float_convert.
(rs6000_return_value): Likewise.
* rs6000-lynx178-tdep.c: Include "target-float.h".
(rs6000_lynx178_push_dummy_call): Use target_float_convert.
(rs6000_lynx178_return_value): Likewise.
* rs6000-tdep.c: Include "target-float.h". Do not include "doublest.h".
(rs6000_register_to_value): Use target_float_convert.
(rs6000_value_to_register): Likewise.
* arm-tdep.c: Include "target-float.h". Do not include "doublest.h".
(arm_extract_return_value): Use target_float_convert.
(arm_store_return_value): Likewise.
* sh-tdep.c: Include "target-float.h". Do not include "doublest.h".
(sh_register_convert_to_virtual): Use target_float_convert.
(sh_register_convert_to_raw): Likewise.
* sh64-tdep.c: Include "target-float.h".
(sh64_extract_return_value): Use target_float_convert.
(sh64_register_convert_to_virtual): Likewise.
(sh64_register_convert_to_raw): Likewise. Fix argument types.

14ad931 2017-11-07 00:00:47 Ulrich Weigand

Target FP: Handle interfaces to scripting languages

The last remaing use for DOUBLEST is in the code that interfaces to the
scripting languages (Python and Guile). The problem here is that we
expose interfaces to convert a GDB value to and from native values of
floating-point type in those languages, and those by definition use
the host floating-point format.

While we cannot completely eliminate conversions to/from the host
floating-point format here, we still need to get rid of the uses
of value_as_double / value_from_double, since those will go away.

This patch implements two new target-float.c routine:
- target_float_to_host_double
- target_float_from_host_double
which convert to/from a host "double". Those should only ever be
used where a host "double" is mandated by an external interface.

gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>

* target-float.c (floatformat_to_host_double): New function.
(floatformat_from_host_double): Likewise.
(target_float_to_host_double): Likewise.
(target_float_from_host_double): Likewise.
* target-float.h (target_float_to_host_double): Add prototype.
(target_float_from_host_double): Likewise.

* guile/scm-value.c: Include "target-float.h".
(gdbscm_value_to_real): Use target_float_to_host_double.
Handle integer source values via value_as_long.
* guile/scm-math.c: Include "target-float.h". Do not include
"doublest.h", "dfp.h", and "expression.h".
(vlscm_convert_typed_number): Use target_float_from_host_double.
(vlscm_convert_number): Likewise.

* python/py-value.c (valpy_float): Use target_float_to_host_double.
(convert_value_from_python): Use target_float_from_host_double.

50eff16 2017-11-07 00:00:12 Ulrich Weigand

Target FP: Perform Ada fixed-point scaling in target format

One of the few still remaining uses of DOUBLEST in GDB is the Ada front-end
code that handles scaling of Ada fixed-point types. The target format for
those types is some integer format; to convert those values to standard
floating-point representation, that integer needs to be multiplied by a
rational scale factor, given as a pair of numerator and denominator.

To avoid having to deal with long integer arithmetic, the current Ada
front-end code currently performs those scaling operations in host
DOUBLEST arithmetic. To eliminate this use of DOUBLEST, this patch
changes the front-end to instead perform those operations in the
*target* floating-point format (chosing to use the target "long double").

The implementation is mostly straight-forward, using value_cast and
value_binop to perform the target operations.

Scanning in the scale numerator and denominator is now done into
a host "long long" instead of a DOUBLEST, which should be large
enough to hold all possible values. (Otherwise, this can be replaced
by target-format target_float_from_string operations as well.)

Printing fixed-point types and values should be completely unchanges,
using target_float_to_string with the same format strings as current code.

gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>

* ada-lang.c (cast_to_fixed): Reimplement in target arithmetic.
(cast_from_fixed): Likewise.
(ada_scaling_type): New function.
(ada_delta): Return value instead of DOUBLEST. Perform target
arithmetic instead of host arithmetic.
(scaling_factor): Rename to ...
(ada_scaling_factor) ... this. Make non-static. Return value instead
of DOUBLEST. Perform target arithmetic instead of host arithmetic.
(ada_fixed_to_float): Remove.
(ada_float_to_fixed): Remove.
* ada-lang.h (ada_fixed_to_float): Remove.
(ada_float_to_fixed): Remove.
(ada_delta): Return value instead of DOUBLEST.
(ada_scaling_factor): Add prototype.

* ada-typeprint.c: Include "target-float.h".
(print_fixed_point_type): Perform target arithmetic instead of
host arithmetic.
* ada-valprint.c: Include "target-float.h".
(ada_val_print_num): Perform target arithmetic instead of
host arithmetic for fixed-point types.

66c02b9 2017-11-06 23:58:46 Ulrich Weigand

Target FP: Add binop and compare routines to target-float.{c,h}

This patch adds the following target floating-point routines:
- target_float_binop
- target_float_compare
which call the equivalent decimal_ routines to handle decimal FP,
and call helper routines that currently still go via DOUBLEST to
handle binary FP (derived from current valarith.c code).

These routines are used to handle both binary and decimal FP types
in scalar_binop, value_equal, and value_less, mostly following the
method currently used for decimal FP. The existing value_args_as_decimal
helper is renamed to value_args_as_target_float and extended to handle
both binary and decimal types.

The unary operations value_pos and value_neg are also simplified,
the former by using a simple copy for all scalar types, the latter
by using value_binop (... BINOP_SUB) to implement negation as
subtraction from zero.

ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>

* target-float.c: Include <math.h>.
(floatformat_binop): New function.
(floatformat_compare): Likewise.
(target_float_binop): Likewise.
(target_float_compare): Likewise.
* target-float.h: Include "expression.h".
(target_float_binop): Add prototype.
(target_float_compare): Likewise.

* valarith.c: Do not include "doublest.h" and "dfp.h".
Include "common/byte-vector.h".
(value_args_as_decimal): Remove, replace by ...
(value_args_as_target_float): ... this function. Handle both
binary and decimal target floating-point formats.
(scalar_binop): Handle both binary and decimal FP using
value_args_as_target_float and target_float_binop.
(value_equal): Handle both binary and decimal FP using
value_args_as_target_float and target_float_compare.
(value_less): Likewise.
(value_pos): Handle all scalar types as simple copy.
(value_neg): Handle all scalar types via BINOP_SUB from 0.
* dfp.c (decimal_binop): Throw error instead of internal_error
when called with an unsupported operation code.