GDB Administrator [Sat, 11 Nov 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 10 Nov 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 9 Nov 2017 22:44:10 +0000 (22:44 +0000)]
Fix racy output matching in gdb.tui/tui-completion.exp
'make check-read1 TESTS="gdb.tui/tui-completion.exp"' exposes this test race:
(gdb) PASS: gdb.tui/completion.exp: set max-completions unlimited
layout ^G
asm next prev regs split src
(gdb) FAIL: gdb.tui/completion.exp: completion of layout names: tab completion
Quit
(gdb) PASS: gdb.tui/completion.exp: completion of layout names: quit command input
focus ^G
cmd next prev src
(gdb) FAIL: gdb.tui/completion.exp: completion of focus command: tab completion
Quit
This is caused by expecting "$gdb_prompt layout $".
gdb_test_multiple's internal prompt regexp can match first if expect's
internal buffer is filled with partial output. Fix that by splitting
the gdb_test_multiple in question in two. Since the same problem/code
appears twice in the file, factor out a common procedure.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.tui/tui-completion.exp (test_tab_completion): New procedure,
factored out from ...
(top level): ... here, and adjusted to avoid expecting beyond the
prompt in a single gdb_test_multiple.
Pedro Alves [Thu, 9 Nov 2017 22:44:09 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/multi-attach.exp, gdb.server/ext-{attach, restart, ext-run}.exp
This commit fixes this same problem in several places:
(gdb) PASS: gdb.multi/multi-attach.exp: backtrace 2
kill
Kill the program being debugged? (y or n) y
(gdb) FAIL: gdb.multi/multi-attach.exp: kill inferior 2 (got interactive prompt)
This is just another case of the gdb_test_multiple's internal "got
interactive prompt" pattern matching because the testcase misses
matching enough.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.multi/multi-attach.exp ("kill" test): Match the whole query
output.
* gdb.server/ext-attach.exp ("kill" test): Likewise.
* gdb.server/ext-restart.exp ("kill" test): Likewise.
* gdb.server/ext-run.exp ("kill" test): Likewise.
* gdb.server/ext-wrapper.exp ("kill" test): Likewise.
Pedro Alves [Thu, 9 Nov 2017 22:44:09 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/cpcompletion.exp
With:
$ make check-read1 TESTS="gdb.cp/cpcompletion.exp"
we get (from gdb.log):
(gdb) complete break Foo::
break Foo::Foo()
break Foo::Foofoo()
break Foo::get_foo()
break Foo::set_foo(int)
break Foo::~Foo()
(gdb) FAIL: gdb.cp/cpcompletion.exp: complete class methods (Foo not found)
The problem is that the
"break ${class}::\[A-Za-z0-9_~\]+"
regexp patches partial input, like:
break Foo::F
break Foo::Fo
break Foo::Foo
etc.
Fix that by expecting each whole line.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.cp/cpcompletion.exp (test_class_complete): Tighten regex to
match till end of line.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/memattr.exp
Testing with:
$ make check-read1 TESTS="gdb.base/memattr.exp"
Exposes a testcase bug that can result in racy fails:
info mem
Using user-defined memory regions.
Num Enb Low Addr High Addr Attrs
1 y 0x0000000000601060 0x0000000000601160 wo nocache
2 y 0x0000000000601180 0x0000000000601280 ro nocache
4 y 0x0000000000601280 0x0000000000601380 rw nocache
3 y 0x0000000000601380 0x0000000000601480 rw nocache
5 y 0x0000000000601480 0x0000000000601580 rw nocache
(gdb) FAIL: gdb.base/memattr.exp: info mem (1)
The problem is that:
"Attrs\[^\n\r]*.."
matches:
"Attrs \r"
when the output buffer is filled with partial output like this:
"info mem\r\nUsing user-defined memory regions.\r\nNum Enb Low Addr High Addr Attrs \r"
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/memattr.exp: Tighten regexes to match the end line.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/completion.exp
Testing with:
$ make check-read1 TESTS="gdb.base/completion.exp"
Exposes a testcase bug that can result in racy fails:
FAIL: gdb.base/completion.exp: command-name completion limiting using tab character
ERROR: Undefined command "".
FAIL: gdb.base/completion.exp: symbol-name completion limiting using tab character
FAIL: gdb.base/completion.exp: symbol-name completion limiting using complete command
testsuite/gdb.log shows:
(gdb) PASS: gdb.base/completion.exp: set max-completions 5
p^G
passcount path print print-object printf
*** List may be truncated, max-completions reached. ***
(gdb) FAIL: gdb.base/completion.exp: command-name completion limiting using tab character
pcomplete p
Undefined command: "pcomplete". Try "help".
(gdb) ERROR: Undefined command "".
The problem is that the expect buffer can get filled with partial
output that ends in the gdb prompt, and so the default FAIL inside
gdb_test_multiple matches.
Fix that by splitting the gdb_test_multiple in two stages. Since that
is done in more than one place in the testcase, move the otherwise
duplicate code to helper procedures.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp (ignore_and_resync, test_tab_complete):
New procedures, factored out from ...
(top level): ... here, and adjusted to avoid expecting beyond the
prompt in one go.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.asm/asm-source.exp
Testing with:
$ make check-read1 TESTS="gdb.asm/asm-source.exp"
Exposes a testcase bug that can result in racy fails:
(gdb) PASS: gdb.asm/asm-source.exp: next over foo3
return
Make selected stack frame return now? (y or n) y
n
#0 main () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.asm/asmsrc1.s:53
53 gdbasm_exit0
(gdb) FAIL: gdb.asm/asm-source.exp: return from foo2 (got interactive prompt)
n
The problem is that the "return now\?.*" regex can match partial
output like this:
"Make selected stack frame return no"
and then we send the 'y' too early, and then the next time around we
hit gdb_test_multiple's internal "got interactive prompt" regex.
Also, note we match "return no" instead of "return now" because the
regex is missing one quote level.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.asm/asm-source.exp ("kill" test): Match the whole query
output. Fix '?' match.
H.J. Lu [Thu, 9 Nov 2017 22:36:51 +0000 (14:36 -0800)]
ld: Reformat emultempl/elf32.em
Reformat emultempl/elf32.em to generate consistent codes.
* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Reformat
to generate consistent codes.
Joel Brobecker [Thu, 9 Nov 2017 19:58:37 +0000 (11:58 -0800)]
fix typos in ada-lang.c comment
gdb/ChangeLog:
* ada-lang.c: Fix some typos in the general command documenting
how Ada expressions are being evaluated and how their result
is printed.
Jim Wilson [Thu, 9 Nov 2017 17:43:59 +0000 (09:43 -0800)]
Fix riscv dwarf2-10 gas testsuite failure.
gas/
* testsuite/gas/elf/dwarf2-10.l: Accept optional line number in error.
Tamar Christina [Thu, 9 Nov 2017 15:50:56 +0000 (15:50 +0000)]
Enable the Dot Product extension by default for Armv8.4-a.
include/
* opcode/aarch64.h (AARCH64_ARCH_V8_4): Enable DOTPROD.
gas/testsuite
* gas/aarch64/dotproduct_armv8_4.s: New.
* gas/aarch64/dotproduct_armv8_4.d: New.
Tamar Christina [Thu, 9 Nov 2017 15:48:43 +0000 (15:48 +0000)]
Add assembler and disassembler support for the new Armv8.4-a registers for AArch64.
Some of these instructions have been back-ported as optional extensions to
Armv8.2-a and higher, but others are only available for Armv8.4-a.
opcodes/
* aarch64-opc.c (aarch64_sys_regs): Add ARMv8.4-a registers;
dit, vstcr_el2, vsttbr_el2, cnthvs_tval_el2, cnthvs_cval_el2,
cnthvs_ctl_el2, cnthps_tval_el2, cnthps_cval_el2, cnthps_ctl_el2,
sder32_el2, vncr_el2.
(aarch64_sys_reg_supported_p): Likewise.
(aarch64_pstatefields): Add dit register.
(aarch64_pstatefield_supported_p): Likewise.
(aarch64_sys_regs_tlbi): Add vmalle1os, vae1os, aside1os, vaae1os,
vale1os, vaale1os, ipas2e1os, ipas2le1os, vae2os, vale2os, vmalls12e1os,
vae3os, vale3os, alle2os, alle1os, alle3os, rvae1, rvaae1, rvale1,
rvaale1, rvae1is, rvaae1is, rvale1is, rvaale1is, rvae1os, rvaae1os,
rvale1os, rvaale1os, ripas2e1is, ripas2le1is, ripas2e1, ripas2le1,
ripas2e1os, ripas2le1os, rvae2, rvale2, rvae2is, rvale2is, rvae2os,
rvale2os, rvae3, rvale3, rvae3is, rvale3is, rvae3os, rvale3os.
gas/testsuite
* gas/aarch64/armv8_4-a-registers-illegal.d: New.
* gas/aarch64/armv8_4-a-registers-illegal.l: New.
* gas/aarch64/armv8_4-a-registers-illegal.s: New.
* gas/aarch64/armv8_4-a-registers.d: New.
* gas/aarch64/armv8_4-a-registers.s: New.
Tamar Christina [Thu, 9 Nov 2017 15:45:00 +0000 (15:45 +0000)]
Add the operand encoding types for the new Armv8.2-a back-ported instructions. These are to be used later when the new instructions are added.
opcodes/
* aarch64-tbl.h (QL_SHA512UPT, QL_V2SAME2D, QL_V3SAME2D): New.
(QL_V4SAME16B, QL_V4SAME4S, QL_XAR, QL_SM3TT, QL_V3FML2S): New.
(QL_V3FML4S, QL_V2FML2S, QL_V2FML4S, QL_RMIF, QL_SETF): New.
(QL_STLW, QL_STLX): New.
Tamar Christina [Thu, 9 Nov 2017 15:22:30 +0000 (15:22 +0000)]
Adds the new Fields and Operand types for the new instructions in Armv8.4-a.
gas/
* config/tc-aarch64.c (process_omitted_operand):
Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2
and AARCH64_OPND_IMM_2.
(parse_operands): Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2,
AARCH64_OPND_IMM_2, AARCH64_OPND_MASK
and AARCH64_OPND_ADDR_OFFSET.
include/
* opcode/aarch64.h:
(aarch64_opnd): Add AARCH64_OPND_Va, AARCH64_OPND_MASK,
AARCH64_OPND_IMM_2, AARCH64_OPND_ADDR_OFFSET
and AARCH64_OPND_SM3_IMM2.
(aarch64_insn_class): Add cryptosm3 and cryptosm4.
(arch64_feature_set): Make uint64_t.
opcodes/
* aarch64-asm.h (ins_addr_offset): New.
* aarch64-asm.c (aarch64_ins_reglane): Add cryptosm3.
(aarch64_ins_addr_offset): New.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_addr_offset): New.
* aarch64-dis.c (aarch64_ext_reglane): Add cryptosm3.
(aarch64_ext_addr_offset): New.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc.h (aarch64_field_kind): Add FLD_imm6_2,
FLD_imm4_2 and FLD_SM3_imm2.
* aarch64-opc.c (fields): Add FLD_imm6_2,
FLD_imm4_2 and FLD_SM3_imm2.
(operand_general_constraint_met_p): Add AARCH64_OPND_ADDR_OFFSET.
(aarch64_print_operand): Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2,
AARCH64_OPND_MASK, AARCH64_OPND_IMM_2 and AARCH64_OPND_ADDR_OFFSET.
* aarch64-opc-2.c (Va, MASK, IMM_2, ADDR_OFFSET, SM3_IMM2): New.
* aarch64-tbl.h
(aarch64_opcode_table): Add Va, MASK, IMM_2, ADDR_OFFSET, SM3_IMM2.
Tom Tromey [Thu, 2 Nov 2017 18:48:44 +0000 (12:48 -0600)]
Simplify the psymbol hash function
This patch simplifies the psymbol_hash function, by changing it not to
examine the contents of the symbol's name. This change just mirrors
what psymbol_compare already does -- it is checking for name equality,
which is ok because symbol names are interned in symbol_set_names.
This change speeds up psymbol reading. "gdb -nx -batch gdb"
previously took ~1.8 seconds on my machine, and with this patch it now
takes ~1.7 seconds.
gdb/ChangeLog
2017-11-09 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_hash): Do not hash string contents.
(psymbol_compare): Add comment.
Tom Tromey [Wed, 1 Nov 2017 17:15:06 +0000 (11:15 -0600)]
Speed up dict_hash
This speeds up dict_hash a bit, by moving the "TKB" check into the
switch in the loop.
For "gdb -nx -readnow -batch gdb", this improves the time from ~9.8s
before to ~8.5s afterward.
gdb/ChangeLog
2017-11-09 Tom Tromey <tom@tromey.com>
* dictionary.c (dict_hash): Move "TKB" check into the "switch".
Tamar Christina [Thu, 9 Nov 2017 11:21:31 +0000 (11:21 +0000)]
Split the ARM Crypto ISA extensions for AES and SHA1+2 into their own options (+aes and +sha2). The reason for the split is because with the introduction of Armv8.4-a the implementation of AES has explicitly been made independent of the implementation of the other crypto extensions.
gas * config/tc-aarch64.c (aarch64_arch_option_table): Add armv8.4-a.
(aarch64_features): Added SM4 and SHA3.
include * opcode/aarch64.h:
(AARCH64_FEATURE_V8_4, AARCH64_FEATURE_SM4): New.
(AARCH64_ARCH_V8_4, AARCH64_FEATURE_SHA3): New.
opcodes * aarch64-tbl.h
(aarch64_feature_v8_4, aarch64_feature_crypto_v8_2): New.
(aarch64_feature_sm4, aarch64_feature_sha3): New.
(aarch64_feature_fp_16_v8_2): New.
(ARMV8_4, SHA3, SM4, CRYPTO_V8_2, FP_F16_V8_2): New.
(V8_4_INSN, CRYPTO_V8_2_INSN): New.
(SHA3_INSN, SM4_INSN, FP16_V8_2_INSN): New.
Nick Clifton [Thu, 9 Nov 2017 10:28:32 +0000 (10:28 +0000)]
Change the type of the aarch64_feature_set typedef to unsigned long long so that it will work on 32-bit hosts.
* opcode/aarch64.h (aarch64_feature_set): Change type to unsigned
long long.
Joel Brobecker [Fri, 3 Mar 2017 16:31:13 +0000 (17:31 +0100)]
local variable watchpoint not deleted after leaving scope
When debugging an Ada program, and inserting a watchpoint tracking
a local variable, the watchpoint doesn't get automatically deleted
upon leaving that variable's scope. This watchpoint then starts
creating problems later on, when trying to resume the program's
execution from a location outside of the watchpoint's scope:
(gdb) c
Continuing.
Breakpoint 2, foo_p708_025 () at foo_p708_025.adb:7
7 Do_Nothing (Val);
(gdb) n
No frame is currently executing in block pck.get_val.
Command aborted.
(gdb) c
Continuing.
No frame is currently executing in block pck.get_val.
Command aborted.
The expected output is the following:
- The program's execution after the first continue should stop
as soon as we reach the end of the watchpoint's scope, and
the debugger should be deleting it.
- Then we can continue until reaching breakpoint 2 above;
- After which we should be able to do next/continue as usual.
The reason the watchpoint is not automatically deleted at scope exit
is because the watchpoint is not marked as being scope-specific
(b->exp_valid_block is equal NULL), and this is because the
symbol lookup for our local variable failed to set the innermost_block
global variable during the lookup.
More precisely, if we look at watch_command_1, we do the following:
innermost_block = NULL;
[...]
exp = parse_exp_1 (&arg, 0, 0, 0);
[...]
exp_valid_block = innermost_block;
Currently, innermost_block stays NULL after the call to parse_exp_1.
Digging further, this innermost_block is typically set during symbol
lookup when the symbol is considered to have a frame-relative address.
For instance, in c-exp.y, we see some code like the following:
if (symbol_read_needs_frame (sym.symbol))
{
if (innermost_block == 0
|| contained_in (sym.block,
innermost_block))
innermost_block = sym.block;
}
We actually have the exact same mechanism in ada-exp.y, except
that it vhas accidently been turned off. See write_var_from_sym,
where we start with:
if (orig_left_context == NULL && symbol_read_needs_frame (sym))
{
if (innermost_block == 0
|| contained_in (block, innermost_block))
innermost_block = block;
}
In this case, orig_left_context is a parameter, and looking at
the point of call in write_var_or_type, we see:
if (nsyms == 1)
{
write_var_from_sym (par_state, block, syms[0].block,
syms[0].symbol);
In the call above, the paramater we are interested in is "block",
which is a parameter for write_var_or_type as well, except we
explicitly override its value at the beginning when found to be NULL:
if (block == NULL)
block = expression_context_block;
So the block we pass to write_var_from_sym is not NULL, and
we therefore don't set innermost_block, which leads to the watchpoint
no longer being marked as scope-specific.
The handling of orig_left_context in write_var_from_sym was there
to handle the case where a user writes an expression where the symbol
is qualified with a scope (Eg: "function::variable"). But it appears
that handling this is specifically here is no longer necessary,
so this patch simply removes that parameter and the associated check,
and then updates all the points of calls.
Interestingly, this also affects GDB/MI, and in particular varobjs,
because local variables are now properly reported as having a block,
which causes the associated varob to have a "thread-id" field.
This patch also adjusts a couple of Ada/gdb-mi tests.
gdb/ChangeLog:
* ada-exp.y (write_var_from_sym): Remove parameter
"orig_left_context". Update all callers.
gdb/testsuite/ChangeLog:
* gdb.ada/scoped_watch: New testcase.
* gdb.ada/watch_arg.exp: Adjust expected behavior to the behavior
which is actually correct.
* gdb.ada/mi_interface.exp: Add missing thread-id in expected varobj.
* gdb.ada/mi_var_array.exp: Add missing thread-id in expected varobj.
Simon Marchi [Thu, 9 Nov 2017 00:42:08 +0000 (19:42 -0500)]
Make encode_actions_rsp use std::vector
Currently, encode_actions_rsp returns two malloc'ed arrays of malloc'ed
strings (char *) by pointer. Change this to use
std::vector<std::string>. This eliminates some cleanups in remote.c.
Regtested on the buildbot.
gdb/ChangeLog:
* tracepoint.h (class collection_list) <stringify>: Return
std::vector<std::string>.
(encode_actions_rsp): Change parameters to
std::vector<std::string> *.
* tracepoint.c (collection_list::stringify): Return
std::vector<std::string> and adjust accordingly.
(encode_actions_rsp): Changee parameters to
std::vector<std::string> and adjust accordingly.
* remote.c (free_actions_list),
free_actions_list_cleanup_wrapper): Remove.
(remote_download_tracepoint): Adjust to std::vector.
H.J. Lu [Wed, 8 Nov 2017 23:56:54 +0000 (15:56 -0800)]
gold: Ignore def/ref from a dynamic object for special symbols
Since special symbol must be defined in a regular object, definition
from a dynamic object should be ignored. If special symbol has the
hidden or internal visibility, reference from a dynamic object should
also be ignored. Also __start and __stop symbols in a dynamic object
shouldn't be preempted.
PR gold/22291
* layout.cc (Layout::define_section_symbols): Use STV_PROTECTED
for __start and __stop symbols.
* symtab.cc (Symbol_table::define_special_symbol): Add an
argument, visibility. Ignore definition and reference from
a dynamic object, depending on visibility.
(Symbol_table::do_define_in_output_data): Pass visibility to
define_special_symbol.
(Symbol_table::do_define_in_output_segment): Likewise.
(Symbol_table::do_define_as_constant): Likewise.
(Symbol_table::add_undefined_symbol_from_command_line): Pass
STV_DEFAULT to define_special_symbol.
* symtab.h (Symbol_table::define_special_symbol): Add an
argument, visibility.
GDB Administrator [Thu, 9 Nov 2017 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 8 Nov 2017 23:42:11 +0000 (23:42 +0000)]
Avoid expensive complaint calls when complaints are disabled
Running perf on "gdb -nx -readnow -batch gdb", I'm seeing a lot of
time (24%.75!) spent in gettext, via complaints. 'perf report -g' shows:
- 86.23% 0.00% gdb gdb [.] gdb_main
- gdb_main
- 85.60% catch_command_errors
symbol_file_add_main_adapter
symbol_file_add_main
symbol_file_add_main_1
symbol_file_add
- symbol_file_add_with_addrs
- 84.31% dw2_expand_all_symtabs
- dw2_instantiate_symtab
- 83.79% dw2_do_instantiate_symtab
- 70.85% process_die
- 41.11% dwarf_decode_macros
- 41.09% dwarf_decode_macro_bytes
- 39.74% dwarf_decode_macro_bytes
>>>>>>>>>>>>>>>>>>>>>>> + 24.75% __dcigettext <<<<<<<
+ 7.37% macro_define_object_internal
+ 3.16% macro_define_function
0.77% splay_tree_insert
+ 0.76% savestring
+ 0.58% free
0.53% read_indirect_string_at_offset_from
0.54% macro_define_object_internal
0.51% macro_start_file
+ 25.57% process_die
+ 4.07% dwarf_decode_lines
+ 4.28% compute_delayed_physnames
+ 3.85% end_symtab_from_static_block
+ 3.38% load_cu
+ 1.29% end_symtab_get_static_block
+ 0.52% do_my_cleanups
+ 1.29% read_symbols
+ 0.54% gdb_init
The problem is that we're always computing the arguments to pass to
complaint, including passing the format strings through gettext, even
when complaints are disabled. As seen above, gettext can be quite
expensive.
Fix this by wrapping complaint in a macro that skips the real
complaint call when complaints are disabled.
This improves "gdb -nx -readnow -batch gdb" from
~11.0s => ~7.8s with -O2 -g3, and
~6.0s => ~5.3s with -O2 -g.
w/ gcc 5.3.1, on x86_64, for me.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* complaints.c (stop_whining): Make extern.
(complaint): Rename to ...
(complaint_internal): ... this.
* complaints.h (complaint): Rename to ...
(complaint_internal): ... this.
(complaint): Reimplement as macro around complaint_internal.
gdb/testsuite/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* gdb.gdb/complaints.exp (test_initial_complaints)
(test_serial_complaints, test_short_complaints): Call
complaint_internal instead of complaint.
James Clarke [Wed, 8 Nov 2017 23:13:53 +0000 (15:13 -0800)]
Fix problems with -r.
The fix committed for PR gold/19291 ended up breaking other cases. The
commit added adjustment code to write_local_symbols, but in many cases
compute_final_local_value_internal had already subtracted the output
section's address. To fix this, all other adjustments are now removed, so
only the one in write_local_symbols is left.
gold/
PR gold/22266
* object.cc (Sized_relobj_file::compute_final_local_value_internal):
Drop relocatable parameter and stop adjusting output value based on
it.
(Sized_relobj_file::compute_final_local_value): Stop passing
relocatable to compute_final_local_value_internal.
(Sized_relobj_file::do_finalize_local_symbols): Ditto.
* object.h (Sized_relobj_file::compute_final_local_value_internal):
Drop relocatable parameter.
Eric Christopher [Wed, 8 Nov 2017 22:03:55 +0000 (14:03 -0800)]
Apply:
2017-11-08 Kyle Butt <iteratee@google.com>
* object.cc (do_find_special_sections): Fix a thinko with memmem return
values and check for != NULL rather than == 0.
Djordje Todorovic [Wed, 8 Nov 2017 21:19:05 +0000 (21:19 +0000)]
Add test for fetching TLS from core file
A correct PID is needed by `libthread_db' library supplied with
glibc repository revisions before commit
c579f48edba8 ("Remove
cached PID/TID in clone") or versions before 2.25 release for
GDB to fetch value of TLS variable from core file. On MIPS
platforms it was omitted and fetching value of TLS variable was not
available.
This adds a new test in order to be sure if GDB on native platforms
can successfully fetch value of TLS variable.
gdb/testsuite:
* gdb.threads/tls-core.c: New file.
* gdb.threads/tls-core.exp: Likewise.
Djordje Todorovic [Wed, 8 Nov 2017 21:19:05 +0000 (21:19 +0000)]
BFD: Extract PID from MIPS core dump file
On MIPS o32, n32 and n64 platforms, PID information was not
correctly propagated from core dump file to internal GDB
structures. This patch fixes that behavior.
A correct PID is needed by `libthread_db' library supplied with
glibc repository revisions before commit
c579f48edba8 ("Remove
cached PID/TID in clone") or released versions before 2.25 for
GDB to fetch value of TLS variable from core file.
bfd/ChangeLog:
* elf32-mips.c (elf32_mips_grok_psinfo): Extract core->pid.
* elf64-mips.c (elf64_mips_grok_psinfo): Likewise.
* elfn32-mips.c (elf32_mips_grok_psinfo): Likewise.
Djordje Todorovic [Wed, 8 Nov 2017 21:19:05 +0000 (21:19 +0000)]
BFD: Write Linux core PRSTATUS note into MIPS core file
On MIPS o32, n32 and n64 platforms information such as PID was not
correctly written into core file from GDB.
This fixes that behavior.
bfd/ChangeLog:
* elf32-mips.c (elf32_mips_write_core_note): New function.
(elf_backend_write_core_note): New macro.
* elf64-mips.c (elf64_mips_write_core_note): New function.
(elf_backend_write_core_note): New macro.
* elfn32-mips.c (elf32_mips_write_core_note): New function.
(elf_backend_write_core_note): New macro.
Tom Tromey [Fri, 3 Nov 2017 20:55:39 +0000 (14:55 -0600)]
Remove symbolp vector
This removes the symbolp typedef from dwarf2read.c and converts the
associated VEC uses to std::vector. This fixes a latent possible
memory leak if an exception were thrown, because there were no
cleanups installed for these VECs.
Regression tested on the buildbot.
gdb/ChangeLog
2017-11-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (symbolp): Remove typedef.
(read_func_scope): Use std::vector.
(process_structure_scope): Use std::vector.
Pedro Alves [Wed, 8 Nov 2017 14:22:34 +0000 (14:22 +0000)]
Make the linespec/location completer ignore data symbols
Currently "b foo[TAB]" offers data symbols as completion candidates.
This doesn't make sense, since you can't set a breakpoint on data
symbols, only on code symbols.
(gdb) b globa[TAB]
(gdb) b global [ENTER]
Function "global" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) info symbol global
global in section .rodata
So this patch makes linespec completion ignore data symbols.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_make_symbol_completion_list): Use
completion_skip_symbol.
* symtab.c (symbol_is_function_or_method(minimal_symbol*)): New.
(symbol_is_function_or_method(symbol*)): New.
(add_symtab_completions): Add complete_symbol_mode parameter. Use
completion_skip_symbol.
(default_collect_symbol_completion_matches_break_on): Use
completion_skip_symbol. Pass down mode.
(collect_file_symbol_completion_matches): Pass down mode.
* symtab.h (symbol_is_function_or_method): New declarations.
(completion_skip_symbol): New template function.
Pedro Alves [Wed, 8 Nov 2017 14:22:34 +0000 (14:22 +0000)]
Use search_domain::FUNCTIONS_DOMAIN when setting breakpoints
While working on C++ support for wild matching, I noticed that
attaching to my system's Firefox (which uses .gdb_index), setting a
break at main and bailing, like:
$ gdb --batch -q -p `pidof firefox` -ex "b main"
would get substancially slower. It'd take around 20s when currently
it takes 3s.
The problem is that gdb would expand more symtabs than currently,
because Firefox has symbols named like "nsHtml5Atoms::main",
"nsGkAtoms::main", etc., which given wild matching, match.
However, these are not function symbols, [they're "(nsIAtom *)"], so
it seems silly that they'd cause expansion in the first place.
The .gdb_index code (dwarf2read.c:dw2_expand_marked_cus) filters out
symbols matches based on search_domain:
case VARIABLES_DOMAIN:
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
continue;
break;
case FUNCTIONS_DOMAIN:
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION)
continue;
break;
case TYPES_DOMAIN:
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
continue;
break;
default:
break;
however, we're currently passing down search_domain::ALL_DOMAIN when
we know we're looking for functions, for no good reason. This patch
fixes that.
It seems like search_domain is underutilized throughout, but I'll
leave using it more for another pass.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* linespec.c (iterate_over_all_matching_symtabs): Add
search_domain parameter. Pass it down to expand_symtabs_matching.
(decode_objc): Request FUNCTIONS_DOMAIN symbols only.
(lookup_prefix_sym): Adjust by passing ALL_DOMAIN as
search_domain.
(add_all_symbol_names_from_pspace): Add search_domain parameter.
Pass it down.
(find_method, find_function_symbols): Request FUNCTIONS_DOMAIN
symbols.
(add_matching_symbols_to_info): Add search_domain parameter. Pass
it down.
Pedro Alves [Wed, 8 Nov 2017 14:22:34 +0000 (14:22 +0000)]
Simplify completion_list_add_name | remove sym_text / sym_text_len
sym_text_len existed to strip parameters out of the lookup name. Now
that that's handled by the lookup_name_info objects, the
sym_text/sym_text_len parameters are no longer necessary.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_make_symbol_completion_list): Remove text and
text_len locals and don't pass them down.
* symtab.c (completion_list_add_name): Remove
sym_text/sym_text_len parameters and adjust.
(completion_list_add_symbol, completion_list_add_msymbol)
(completion_list_objc_symbol, completion_list_add_fields)
(add_symtab_completions): Likewise.
(default_collect_symbol_completion_matches_break_on)
(collect_file_symbol_completion_matches): Remove sym_text_len
local and don't pass it down.
* symtab.h (completion_list_add_name): Remove
sym_text/sym_text_len parameters.
Pedro Alves [Wed, 8 Nov 2017 14:49:10 +0000 (14:49 +0000)]
lookup_name_info::make_ignore_params
A few places in the completion code look for a "(" to find a
function's parameter list, in order to strip it, because psymtabs (and
gdb index) don't include parameter info in the symbol names.
See compare_symbol_name and
default_collect_symbol_completion_matches_break_on.
This is too naive. Consider:
ns_overload2_test::([TAB]
We'd want to complete that to:
ns_overload2_test::(anonymous namespace)::struct_overload2_test
Or:
b (anonymous namespace)::[TAB]
That currently completes to:
b (anonymous namespace)
Which is obviously broken. This patch makes that work.
Also, the current compare_symbol_name hack means that while this
works:
"b function([TAB]" -> "b function()"
This does not:
"b function ([TAB]"
This patch fixes that. Whitespace "ignoring" now Just Works, i.e.,
assuming a symbol named "function(int, long)", this:
b function ( int , lon[TAB]
completes to:
b function ( int , long)
To address all of this, this patch builds on top of the rest of the
series, and pushes the responsibility of stripping parameters from a
lookup name to the new lookup_name_info object, where we can apply
per-language rules. Also note that we now only make a version of the
lookup name with parameters stripped out where it's actually required
to do that, in the psymtab and GDB index code.
For C++, the right way to strip parameters is with "cp_remove_params",
which uses a real parser (cp-name-parser.y) to split the name into a
component tree and then discards parameters.
The trouble for completion is that in that case we have an incomplete
name, like "foo::func(int" and thus cp_remove_params throws an error.
This patch sorts that by adding a cp_remove_params_if_any variant of
cp_remove_params that tries removing characters from the end of the
string until cp_remove_params works. So cp_remove_params_if_any
behaves like this:
With a complete name:
"foo::func(int)" => foo::func(int) # cp_remove_params_1 succeeds the first time.
With an incomplete name:
"foo::func(int" => NULL # cp_remove_params fails the first time.
"foo::func(in" => NULL # and again...
"foo::func(i" => NULL # and again...
"foo::func(" => NULL # and again...
"foo::func" => "foo::func" # success!
Note that even if this approach removes significant rightmost
characters, it's still OK, because this parameter stripping is only
necessary for psymtabs and gdb index, where we're determining whether
to expand a symbol table. Say cp_remove_params_if_any returned
"foo::" above for "foo::func(int". That'd cause us to expand more
symtabs than ideal (because we'd expand all symtabs with symbols that
start with "foo::", not just "foo::func"), but then when we actually
look for completion matches, we'd still use the original lookup name,
with parameter information ["foo::func(int"], and thus we'll return no
false positive to the user. Whether the stripping works as intended
and doesn't strip too much is thus covered by a unit test instead of a
testsuite test.
The "if_any" part of the name refers to the fact that while
cp_remove_params returns NULL if the input name has no parameters in
the first place, like:
"foo::func" => NULL # cp_remove_params
cp_remove_params_if_any still returns the function name:
"foo::func" => "foo::func" # cp_remove_params_if_any
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/lookup_name_info-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add lookup_name_info-selftests.o.
* cp-support.c: Include "selftest.h".
(cp_remove_params_1): Rename from cp_remove_params. Add
'require_param' parameter, and handle it.
(cp_remove_params): Reimplement.
(cp_remove_params_if_any): New.
(selftests::quote): New.
(selftests::check_remove_params): New.
(selftests::test_cp_remove_params): New.
(_initialize_cp_support): Install
selftests::test_cp_remove_params.
* cp-support.h (cp_remove_params_if_any): Declare.
* dwarf2read.c :Include "selftest.h".
(dw2_expand_symtabs_matching_symbol): Use
lookup_name_info::make_ignore_params.
(selftests::dw2_expand_symtabs_matching::mock_mapped_index)
(selftests::dw2_expand_symtabs_matching::string_or_null)
(selftests::dw2_expand_symtabs_matching::check_match)
(selftests::dw2_expand_symtabs_matching::test_symbols)
(selftests::dw2_expand_symtabs_matching::run_test): New.
(_initialize_dwarf2_read): Register
selftests::dw2_expand_symtabs_matching::run_test.
* psymtab.c (psym_expand_symtabs_matching): Use
lookup_name_info::make_ignore_params.
* symtab.c (demangle_for_lookup_info::demangle_for_lookup_info):
If the lookup name wants to ignore parameters, strip them.
(compare_symbol_name): Remove sym_text/sym_text_len parameters and
code handling '('.
(completion_list_add_name): Don't pass down sym_text/sym_text_len.
(default_collect_symbol_completion_matches_break_on): Don't try to
strip parameters.
* symtab.h (lookup_name_info::lookup_name_info): Add
'ignore_parameters' parameter.
(lookup_name_info::ignore_parameters)
(lookup_name_info::make_ignore_params): New methods.
(lookup_name_info::m_ignore_parameters): New field.
* unittests/lookup_name_info-selftests.c: New file.
Pedro Alves [Wed, 8 Nov 2017 14:22:32 +0000 (14:22 +0000)]
Reorder/reindent dw2_expand_symtabs_matching & friends
The previous patch had added dw2_expand_symtabs_matching_symbol and
dw2_expand_marked_cus forward declarations and did not reindent
dw2_expand_marked_cus to avoid moving the code around while changing
it at the same time.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (dw2_expand_marked_cus)
(dw2_expand_symtabs_matching_symbol): Remove forward declarations.
(dw2_expand_symtabs_matching): Move further below.
(dw2_expand_marked_cus): Reindent.
Pedro Alves [Wed, 8 Nov 2017 14:22:32 +0000 (14:22 +0000)]
Optimize .gdb_index symbol name searching
As mentioned in the previous patch, .gdb_index name lookup got
significantly slower with the previous patch.
This patch addresses that, and in the process makes .gdb_index name
searching faster than what we had before the previous patch, even.
Using the same test:
$ cat script.cmd
set pagination off
set $count = 0
while $count < 400
complete b string_prin
printf "count = %d\n", $count
set $count = $count + 1
end
$ time gdb --batch -q ./gdb-with-index -ex "source script.cmd"
I got, before the previous patch (-O2, x86-64):
real 0m1.773s
user 0m1.737s
sys 0m0.040s
and after this patch:
real 0m1.361s
user 0m1.315s
sys 0m0.040s
The basic idea here is simple: instead of always iterating over all
the symbol names in the index, we build an accelerator/sorted name
table and binary search names in it.
Later in the series, we'll want to support wild matching for C++ too,
so this mechanism already considers that. For example, say that
you're looking up functions/methods named "func", no matter the
containing namespace/class. If we sorted the table by qualified name,
then we obviously wouldn't be able to find those symbols with a binary
search:
func
ns1::a::b::func
ns1::b::func
ns2::func
(function symbol names in .gdb_index have no parameter info, like psymbols)
To address that out, we put an entry for each name component in the
sorted table. something like this:
Table Entry Actual symbol
---------------------------------
func func
func ns1::a::b::func
b::func ns1::a::b::func
a::b::func ns1::a::b::func
ns1::a::b::func ns1::a::b::func
func ns1::b::func
b::func ns1::b::func
ns1::b::func ns1::b::func
func ns2::func
ns2::func ns2::func
Which sorted results in this:
Table Entry Actual symbol
---------------------------------
a::b::func ns1::a::b::func
b::func ns1::a::b::func
b::func ns1::b::func
func func
func ns1::a::b::func
func ns1::b::func
func ns2::func
ns1::a::b::func ns1::a::b::func
ns1::b::func ns1::b::func
ns2::func ns2::func
And we can binary search this.
Note that a binary search approach works for both completion and
regular lookup, while a name hashing approach only works for normal
symbol looking, since obviously "fun" and "func" have different
hashes.
At first I was a bit wary of these tables potentially growing GDB's
memory significantly. But I did an experiment that convinced it's not
a worry at all. I hacked gdb to count the total number of entries in
all the tables, attached that gdb to my system/Fedora's Firefox
(Fedora's debug packages uses .gdb_index), did "set max-completions
unlimited", and then hit "b [TAB]" to cause everything to expand.
That resulted in 1351355 name_components. Each entry takes 8 bytes,
so that's
10810840 bytes (ignoring std::vector overhead), or ~10.3 MB.
That's IMO too small to worry about, given GDB was using over 7400MB
total at that point. I.e., we're talking about 0.1% increase.
dw2_expand_symtabs_matching unit tests covering this will be added in
a follow up patch.
If the size of this table turns out to be a concern, I have an idea to
reduce the size of the table further at the expense of a bit more code
-- the vast majority of the name offsets are either 0 or fit in
8-bits:
total name_component = 1351355, of which,
name_component::name_offset instances need 0 bits = 679531
name_component::name_offset instances need 8 bits = 669526
name_component::name_offset instances need 16 bits = 2298
name_component::name_offset instances need 32 bits = 0
name_component::idx instances need 0 bits = 51
name_component::idx instances need 8 bits = 8361
name_component::idx instances need 16 bits = 280329
name_component::idx instances need 32 bits = 1062614
so we could have separate tables for 0 name_offset, 8-bit name_offset
and 32-bit name_offset. That'd give us roughly:
679531 * 0 + 669526 * 1 + 2298 * 4 + 1062614 * 4 = 4929174, or ~4.7MB
with only 8-bit and 32-bit tables, that'd be:
1349057 * 1 + 2298 * 4 + 4 * 1351355 = 6763669 bytes, or ~6.5MB.
I don't think we need to bother though.
I also timed:
$ time gdb --batch -q -p `pidof firefox`
$ time gdb --batch -q -p `pidof firefox` -ex "b main"
$ time gdb --batch -q -p `pidof firefox` -ex "set max-completion unlimited" -ex "complete b "
and compared before previous patch vs this patch, and I didn't see a
significant difference, seemingly because time to read debug info
dominates. The "complete b " variant of the test takes ~2min
currently... (I have a follow up series that speeds that up
somewhat.)
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (byte_swap, MAYBE_SWAP): Move higher up in file.
(struct name_component): New.
(mapped_index::name_components): New field.
(mapped_index::symbol_name_at): New method.
(dwarf2_read_index): Call mapped_index ctor.
(dw2_map_matching_symbols): Add comment about name_components
table.
(dw2_expand_symtabs_matching): Factor part to...
(dw2_expand_symtabs_matching_symbol): ... this new function.
Build name components table, and lookup symbols in it before
calling the name matcher.
(dw2_expand_marked_cus): New, factored out from
dw2_expand_symtabs_matching.
(dwarf2_per_objfile_free): Call the mapped_index's dtor.
Pedro Alves [Wed, 8 Nov 2017 14:22:32 +0000 (14:22 +0000)]
Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
Summary:
- This is preparation for supporting wild name matching on C++ too.
- This is also preparation for TAB-completion fixes.
- Makes symbol name matching (think strcmp_iw) be based on a per-language method.
- Merges completion and non-completion name comparison (think
language_ops::la_get_symbol_name_cmp generalized).
- Avoid re-hashing lookup name multiple times
- Centralizes preparing a name for lookup (Ada name encoding / C++ Demangling),
both completion and non-completion.
- Fixes Ada latent bug with verbatim name matches in expressions
- Makes ada-lang.c use common|symtab.c completion code a bit more.
Ada's wild matching basically means that
"(gdb) break foo"
will find all methods named "foo" in all packages. Translating to
C++, it's roughly the same as saying that "break klass::method" sets
breakpoints on all "klass::method" methods of all classes, no matter
the namespace. A following patch will teach GDB about fullname vs
wild matching for C++ too. This patch is preparatory work to get
there.
Another idea here is to do symbol name matching based on the symbol
language's algorithm. I.e., avoid dependency on current language set.
This allows for example doing
(gdb) b foo::bar< int > (<tab>
and having gdb name match the C++ symbols correctly even if the
current language is C or Assembly (or Rust, or Ada, or ...), which can
easily happen if you step into an Assembly/C runtime library frame.
By encapsulating all the information related to a lookup name in a
class, we can also cache hash computation for a given language in the
lookup name object, to avoid recomputing it over and over.
Similarly, because we don't really know upfront which languages the
lookup name will be matched against, for each language we store the
lookup name transformed into a search name. E.g., for C++, that means
demangling the name. But for Ada, it means encoding the name. This
actually forces us to centralize all the different lookup name
encoding in a central place, resulting in clearer code, IMO. See
e.g., the new ada_lookup_name_info class.
The lookup name -> symbol search name computation is also done only
once per language.
The old language->la_get_symbol_name_cmp / symbol_name_cmp_ftype are
generalized to work with both completion, and normal symbol look up.
At some point early on, I had separate completion vs non-completion
language vector entry points, but a single method ends up being better
IMO for simplifying things -- the more we merge the completion /
non-completion name lookup code paths, the less changes for bugs
causing completion vs normal lookup finding different symbols.
The ada-lex.l change is necessary because when doing
(gdb) p <UpperCase>
then the name that is passed to write_ write_var_or_type ->
ada_lookup_symbol_list misses the "<>", i.e., it's just "UpperCase",
and we end up doing a wild match against "UpperCase" lowercased by
ada_lookup_name_info's constructor. I.e., "uppercase" wouldn't ever
match "UpperCase", and the symbol lookup fails.
This wouldn't cause any regression in the testsuite, but I added a new
test that would pass before the patch and fail after, if it weren't
for that fix.
This is latent bug that happens to go unnoticed because that
particular path was inconsistent with the rest of Ada symbol lookup by
not lowercasing the lookup name.
Ada's symbol_completion_add is deleted, replaced by using common
code's completion_list_add_name. To make the latter work for Ada, we
needed to add a new output parameter, because Ada wants to return back
a custom completion candidates that are not the symbol name.
With this patch, minimal symbol demangled name hashing is made
consistent with regular symbol hashing. I.e., it now goes via the
language vector's search_name_hash method too, as I had suggested in a
previous patch.
dw2_expand_symtabs_matching / .gdb_index symbol names were a
challenge. The problem is that we have no way to telling what is the
language of each symbol name found in the index, until we expand the
corresponding full symbol, which is off course what we're trying to
avoid. Language information is simply not considered in the index
format... Since the symbol name hashing and comparison routines are
per-language, we now have a problem. The patch sorts this out by
matching each name against all languages. This is inneficient, and
indeed slows down completion several times. E.g., with:
$ cat script.cmd
set pagination off
set $count = 0
while $count < 400
complete b string_prin
printf "count = %d\n", $count
set $count = $count + 1
end
$ time gdb --batch -q ./gdb-with-index -ex "source script-string_printf.cmd"
I get, before patch (-O2, x86-64):
real 0m1.773s
user 0m1.737s
sys 0m0.040s
While after patch (-O2, x86-64):
real 0m9.843s
user 0m9.482s
sys 0m0.034s
However, the following patch will optimize this, and will actually
make this use case faster compared to the "before patch" above:
real 0m1.321s
user 0m1.285s
sys 0m0.039s
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_encode): Rename to ..
(ada_encode_1): ... this. Add throw_errors parameter and handle
it.
(ada_encode): Reimplement.
(match_name): Delete, folded into full_name.
(resolve_subexp): No longer pass the encoded name to
ada_lookup_symbol_list.
(should_use_wild_match): Delete.
(name_match_type_from_name): New.
(ada_lookup_simple_minsym): Use lookup_name_info and the
language's symbol_name_matcher_ftype.
(add_symbols_from_enclosing_procs, ada_add_local_symbols)
(ada_add_block_renamings): Adjust to use lookup_name_info.
(ada_lookup_name): New.
(add_nonlocal_symbols, ada_add_all_symbols)
(ada_lookup_symbol_list_worker, ada_lookup_symbol_list)
(ada_iterate_over_symbols): Adjust to use lookup_name_info.
(ada_name_for_lookup): Delete.
(ada_lookup_encoded_symbol): Construct a verbatim name.
(wild_match): Reverse sense of return type. Use bool.
(full_match): Reverse sense of return type. Inline bits of old
match_name here.
(ada_add_block_symbols): Adjust to use lookup_name_info.
(symbol_completion_match): Delete, folded into...
(ada_lookup_name_info::matches): ... .this new method.
(symbol_completion_add): Delete.
(ada_collect_symbol_completion_matches): Add name_match_type
parameter. Adjust to use lookup_name_info and
completion_list_add_name.
(get_var_value, ada_add_global_exceptions): Adjust to use
lookup_name_info.
(ada_get_symbol_name_cmp): Delete.
(do_wild_match, do_full_match): New functions.
(ada_lookup_name_info::ada_lookup_name_info): New method.
(ada_symbol_name_matches, ada_get_symbol_name_matcher): New
functions.
(ada_language_defn): Install ada_get_symbol_name_matcher.
* ada-lex.l (processId): If name starts with '<', copy it
verbatim.
* block.c (block_iter_match_step, block_iter_match_first)
(block_iter_match_next, block_lookup_symbol)
(block_lookup_symbol_primary, block_find_symbol): Adjust to use
lookup_name_info.
* block.h (block_iter_match_first, block_iter_match_next)
(ALL_BLOCK_SYMBOLS_WITH_NAME): Adjust to use lookup_name_info.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Adjust comments to
refer to la_get_symbol_name_matcher.
* completer.c (complete_files_symbols)
(collect_explicit_location_matches, symbol_completer): Pass a
symbol_name_match_type down.
* completer.h (class completion_match, completion_match_result):
New classes.
(completion_tracker::reset_completion_match_result): New method.
(completion_tracker::m_completion_match_result): New field.
* cp-support.c (make_symbol_overload_list_block): Adjust to use
lookup_name_info.
(cp_fq_symbol_name_matches, cp_get_symbol_name_matcher): New
functions.
* cp-support.h (cp_get_symbol_name_matcher): New declaration.
* d-lang.c: Adjust comments to refer to
la_get_symbol_name_matcher.
* dictionary.c (dict_vector) <iter_match_first, iter_match_next>:
Adjust to use lookup_name_info.
(dict_iter_match_first, dict_iter_match_next)
(iter_match_first_hashed, iter_match_next_hashed)
(iter_match_first_linear, iter_match_next_linear): Adjust to work
with a lookup_name_info.
* dictionary.h (dict_iter_match_first, dict_iter_match_next):
Likewise.
* dwarf2read.c (dw2_lookup_symbol): Adjust to use lookup_name_info.
(dw2_map_matching_symbols): Adjust to use symbol_name_match_type.
(gdb_index_symbol_name_matcher): New class.
(dw2_expand_symtabs_matching) Adjust to use lookup_name_info and
gdb_index_symbol_name_matcher. Accept a NULL symbol_matcher.
* f-lang.c (f_collect_symbol_completion_matches): Adjust to work
with a symbol_name_match_type.
(f_language_defn): Adjust comments to refer to
la_get_symbol_name_matcher.
* go-lang.c (go_language_defn): Adjust comments to refer to
la_get_symbol_name_matcher.
* language.c (default_symbol_name_matcher)
(language_get_symbol_name_matcher): New functions.
(unknown_language_defn, auto_language_defn): Adjust comments to
refer to la_get_symbol_name_matcher.
* language.h (symbol_name_cmp_ftype): Delete.
(language_defn) <la_collect_symbol_completion_matches>: Add match
type parameter.
<la_get_symbol_name_cmp>: Delete field.
<la_get_symbol_name_matcher>: New field.
<la_iterate_over_symbols>: Adjust to use lookup_name_info.
(default_symbol_name_matcher, language_get_symbol_name_matcher):
Declare.
* linespec.c (iterate_over_all_matching_symtabs)
(iterate_over_file_blocks): Adjust to use lookup_name_info.
(find_methods): Add language parameter, and use lookup_name_info
and the language's symbol_name_matcher_ftype.
(linespec_complete_function): Adjust.
(lookup_prefix_sym): Use lookup_name_info.
(add_all_symbol_names_from_pspace): Adjust.
(find_superclass_methods): Add language parameter and pass it
down.
(find_method): Pass symbol language down.
(find_linespec_symbols): Don't demangle or Ada encode here.
(search_minsyms_for_name): Add lookup_name_info parameter.
(add_matching_symbols_to_info): Add name_match_type parameter.
Use lookup_name_info.
* m2-lang.c (m2_language_defn): Adjust comments to refer to
la_get_symbol_name_matcher.
* minsyms.c: Include <algorithm>.
(add_minsym_to_demangled_hash_table): Remove table parameter and
add objfile parameter. Use search_name_hash, and add language to
demangled languages vector.
(struct found_minimal_symbols): New struct.
(lookup_minimal_symbol_mangled, lookup_minimal_symbol_demangled):
New functions.
(lookup_minimal_symbol): Adjust to use them. Don't canonicalize
input names here. Use lookup_name_info instead. Lookup up
demangled names once for each language in the demangled names
vector.
(iterate_over_minimal_symbols): Use lookup_name_info. Lookup up
demangled names once for each language in the demangled names
vector.
(build_minimal_symbol_hash_tables): Adjust.
* minsyms.h (iterate_over_minimal_symbols): Adjust to pass down a
lookup_name_info.
* objc-lang.c (objc_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* objfiles.h: Include <vector>.
(objfile_per_bfd_storage) <demangled_hash_languages>: New field.
* opencl-lang.c (opencl_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* p-lang.c (pascal_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* psymtab.c (psym_lookup_symbol): Use lookup_name_info.
(match_partial_symbol): Use symbol_name_match_type,
lookup_name_info and psymbol_name_matches.
(lookup_partial_symbol): Use lookup_name_info.
(map_block): Use symbol_name_match_type and lookup_name_info.
(psym_map_matching_symbols): Use symbol_name_match_type.
(psymbol_name_matches): New.
(recursively_search_psymtabs): Use lookup_name_info and
psymbol_name_matches. Rename 'kind' parameter to 'domain'.
(psym_expand_symtabs_matching): Use lookup_name_info. Rename
'kind' parameter to 'domain'.
* rust-lang.c (rust_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* symfile-debug.c (debug_qf_map_matching_symbols)
(debug_qf_map_matching_symbols): Use symbol_name_match_type.
(debug_qf_expand_symtabs_matching): Use lookup_name_info.
* symfile.c (expand_symtabs_matching): Use lookup_name_info.
* symfile.h (quick_symbol_functions) <map_matching_symbols>:
Adjust to use symbol_name_match_type.
<expand_symtabs_matching>: Adjust to use lookup_name_info.
(expand_symtabs_matching): Adjust to use lookup_name_info.
* symmisc.c (maintenance_expand_symtabs): Use
lookup_name_info::match_any ().
* symtab.c (symbol_matches_search_name): New.
(eq_symbol_entry): Adjust to use lookup_name_info and the
language's matcher.
(demangle_for_lookup_info::demangle_for_lookup_info): New.
(lookup_name_info::match_any): New.
(iterate_over_symbols, search_symbols): Use lookup_name_info.
(compare_symbol_name): Add language, lookup_name_info and
completion_match_result parameters, and use them.
(completion_list_add_name): Make extern. Add language and
lookup_name_info parameters. Use them.
(completion_list_add_symbol, completion_list_add_msymbol)
(completion_list_objc_symbol): Add lookup_name_info parameters and
adjust. Pass down language.
(completion_list_add_fields): Add lookup_name_info parameters and
adjust. Pass down language.
(add_symtab_completions): Add lookup_name_info parameters and
adjust.
(default_collect_symbol_completion_matches_break_on): Add
name_match_type parameter, and use it. Use lookup_name_info.
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches): Add name_match_type
parameter, and pass it down.
(collect_symbol_completion_matches_type): Adjust.
(collect_file_symbol_completion_matches): Add name_match_type
parameter, and use lookup_name_info.
* symtab.h: Include <string> and "common/gdb_optional.h".
(enum class symbol_name_match_type): New.
(class ada_lookup_name_info): New.
(struct demangle_for_lookup_info): New.
(class lookup_name_info): New.
(symbol_name_matcher_ftype): New.
(SYMBOL_MATCHES_SEARCH_NAME): Use symbol_matches_search_name.
(symbol_matches_search_name): Declare.
(MSYMBOL_MATCHES_SEARCH_NAME): Delete.
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches)
(collect_file_symbol_completion_matches): Add name_match_type
parameter.
(iterate_over_symbols): Use lookup_name_info.
(completion_list_add_name): Declare.
* utils.c (enum class strncmp_iw_mode): Moved to utils.h.
(strncmp_iw_with_mode): Now extern.
* utils.h (enum class strncmp_iw_mode): Moved from utils.c.
(strncmp_iw_with_mode): Declare.
gdb/testsuite/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* gdb.ada/complete.exp (p <Exported_Capitalized>): New test.
(p Exported_Capitalized): New test.
(p exported_capitalized): New test.
Pedro Alves [Wed, 8 Nov 2017 15:07:56 +0000 (15:07 +0000)]
Per-language symbol name hashing algorithm
Currently, we have a mess of symbol name hashing/comparison routines.
There's msymbol_hash for mangled names, and dict_hash and
msymbol_hash_iw for demangled names. Then there's strcmp_iw,
strcmp_iw_ordered and Ada's full_match/wild_match, which all have to
agree with the hashing routines. That's why dict_hash is really about
Ada names. From the inconsistency department, minimal symbol hashing
doesn't go via dict_hash, so Ada's wild matching can't ever work with
minimal symbols.
This patch starts fixing this, by doing two things:
#1 - adds a language vector method to let each language decide how to
compute a symbol name hash.
#2 - makes dictionaries know the language of the symbols they hold,
and then use the dictionaries language to decide which hashing
method to use.
For now, this is just scaffolding, since all languages install the
default method. The series will make C++ install its own hashing
method later on, and will add per-language symbol name comparison
routines too.
This patch was originally based on a patch that Keith wrote for the
libcc1/C++ WIP support.
gdb/ChangeLog:
2017-11-08 Keith Seitz <keiths@redhat.com>
Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_language_defn): Install
default_search_name_hash.
* buildsym.c (struct buildsym_compunit): <language>: New field.
(finish_block_internal): Pass language when creating dictionaries.
(start_buildsym_compunit, start_symtab): New language parameters.
Use them.
(restart_symtab): Pass down compilation unit's language.
* buildsym.h (enum language): Forward declare.
(start_symtab): New 'language' parameter.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Install
default_search_name_hash.
* coffread.c (coff_start_symtab): Adjust.
* d-lang.c (d_language_defn): Install default_search_name_hash.
* dbxread.c (struct symloc): Add 'pst_language' field.
(PST_LANGUAGE): Define.
(start_psymtab, read_ofile_symtab): Use it.
(process_one_symbol): New 'language' parameter. Pass it down.
* dictionary.c (struct dictionary) <language>: New field.
(DICT_LANGUAGE): Define.
(dict_create_hashed, dict_create_hashed_expandable)
(dict_create_linear, dict_create_linear_expandable): New parameter
'language'. Set the dictionary's language.
(iter_match_first_hashed): Adjust to rename.
(insert_symbol_hashed): Assert we don't see mismatching
languages. Adjust to rename.
(dict_hash): Rename to ...
(default_search_name_hash): ... this and make extern.
* dictionary.h (struct language_defn): Forward declare.
(dict_create_hashed): New parameter 'language'.
* dwarf2read.c (dwarf2_start_symtab): Pass down language.
* f-lang.c (f_language_defn): Install default_search_name_hash.
* go-lang.c (go_language_defn): Install default_search_name_hash.
* jit.c (finalize_symtab): Pass compunit's language to dictionary
creation.
* language.c (unknown_language_defn, auto_language_defn):
* language.h (language_defn::la_search_name_hash): New field.
(default_search_name_hash): Declare.
* m2-lang.c (m2_language_defn): Install default_search_name_hash.
* mdebugread.c (new_block): New parameter 'language'.
* mdebugread.c (parse_symbol): Pass symbol language to block
allocation.
(psymtab_to_symtab_1): Pass down language.
(new_symtab): Pass compunit's language to block allocation.
* objc-lang.c (objc_language_defn): Install
default_search_name_hash.
* opencl-lang.c (opencl_language_defn):
* p-lang.c (pascal_language_defn): Install
default_search_name_hash.
* rust-lang.c (rust_language_defn): Install
default_search_name_hash.
* stabsread.h (enum language): Forward declare.
(process_one_symbol): Add 'language' parameter.
* symtab.c (search_name_hash): New function.
* symtab.h (search_name_hash): Declare.
* xcoffread.c (read_xcoff_symtab): Pass language to start_symtab.
Pedro Alves [Wed, 8 Nov 2017 15:20:41 +0000 (15:20 +0000)]
Fix "make test-cp-name-parser"
src/gdb/cp-name-parser.y: In function ‘int main(int, char**)’:
src/gdb/cp-name-parser.y:2132:30: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
char *str2, *extra_chars = "", c;
^
Simply don't initialize the variable, it's not necessary.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* cp-name-parser.y (main): Don't initialize extra_chars.
Nick Clifton [Wed, 8 Nov 2017 14:34:32 +0000 (14:34 +0000)]
Fix typo in changelog
Nick Clifton [Wed, 8 Nov 2017 14:30:53 +0000 (14:30 +0000)]
Split the AArch64 Crypto instructions for AES and SHA1+2 into their own options (+aes and +sha2).
The new options are:
+aes: Enables the AES instructions of Armv8-a,
enabled by default with +crypto.
+sha2: Enables the SHA1 and SHA2 instructions of Armv8-a,
enabled by default with +crypto.
These options have been turned on by default when +crypto
is used, as such no breakage is expected.
The reason for the split is because with the introduction of Armv8.4-a
the implementation of AES has explicitly been made independent of the
implementation of the other crypto extensions. Backporting the split does
not break any of the previous requirements and so is safe to do.
gas * config/tc-aarch64.c
(aarch64_features): Include AES and SHA2 in CRYPTO.
Add SHA2 and AES.
include * opcode/aarch64.h:
(AARCH64_FEATURE_SHA2, AARCH64_FEATURE_AES): New.
opcodes * aarch64-tbl.h (aarch64_feature_crypto): Add AES and SHA2.
(aarch64_feature_sha2, aarch64_feature_aes): New.
(SHA2, AES): New.
(AES_INSN, SHA2_INSN): New.
(pmull, pmull2, aese, aesd, aesmc, aesimc): Change to AES_INS.
(sha1h, sha1su1, sha256su0, sha1c, sha1p,
sha1m, sha1su0, sha256h, sha256h2, sha256su1):
Change to SHA2_INS.
Jiong Wang [Wed, 8 Nov 2017 13:15:12 +0000 (13:15 +0000)]
Adds command line support for Armv8.4-A, via the new command line option -march=armv8.4-a. Add support for "+dotprod" ARM feature (required for ARMv8.4-A). Add assembler and disassembler support for new FP16 instructions introduced in Armv8.4-A
gas * config/tc-arm.c (arm_extensions):
(arm_archs): New entry for "armv8.4-a".
Add FPU_ARCH_DOTPROD_NEON_VFP_ARMV8.
(arm_ext_v8_2): New variable.
(enum arm_reg_type): New enumeration REG_TYPE_NSD.
(reg_expected_msgs): New entry for REG_TYPE_NSD.
(parse_typed_reg_or_scalar): Handle REG_TYPE_NSD.
(parse_scalar): Support REG_TYPE_VFS.
(enum operand_parse_code): New enumerations OP_RNSD and OP_RNSD_RNSC.
(parse_operands): Handle OP_RNSD and OP_RNSD_RNSC.
(NEON_SHAPE_DEF): New entries for DHH and DHS.
(neon_scalar_for_fmac_fp16_long): New function to generate Rm encoding
for new FP16 instructions in ARMv8.2-A.
(do_neon_fmac_maybe_scalar_long): New function to encode new FP16
instructions in ARMv8.2-A.
(do_neon_vfmal): Wrapper function for vfmal.
(do_neon_vfmsl): Wrapper function for vfmsl.
(insns): New entries for vfmal and vfmsl.
* doc/c-arm.texi (-march): Document "armv8.4-a".
* testsuite/gas/arm/dotprod-mandatory.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16.s: New test source.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.s: New test source.
* testsuite/gas/arm/armv8_2-a-fp16.d: New test.
* testsuite/gas/arm/armv8_3-a-fp16.d: New test.
* testsuite/gas/arm/armv8_4-a-fp16.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16-thumb2.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.l: New error file.
opcodes * arm-dis.c (coprocessor_opcodes): New entries for ARMv8.2-A new
FP16 instructions, including vfmal.f16 and vfmsl.f16.
include * opcode/arm.h (ARM_AEXT2_V8_4A): Include Dot Product feature.
(ARM_EXT2_V8_4A): New macro.
(ARM_AEXT2_V8_4A): Likewise.
(ARM_ARCH_V8_4A): Likewise.
Alan Modra [Tue, 7 Nov 2017 06:33:41 +0000 (17:03 +1030)]
xtensa message pluralization
* config/tc-xtensa.c (finish_vinsn): Properly pluralize error message.
GDB Administrator [Wed, 8 Nov 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 15 Oct 2017 14:36:51 +0000 (08:36 -0600)]
Constify execute_command
This constifies execute_command and fixes up the callers.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* event-top.h (command_handler): Constify.
* record-full.c (cmd_record_full_start): Update.
* thread.c (thread_apply_all_command): Update.
* printcmd.c (eval_command): Update.
* mi/mi-main.c (mi_execute_cli_command): Update.
(mi_execute_async_cli_command): Update.
* tui/tui-stack.c (tui_update_command): Update.
* cli/cli-interp.c (safe_execute_command): Constify.
* record.c (record_start): Update.
(record_start, record_stop, cmd_record_start): Update.
* record-btrace.c (cmd_record_btrace_bts_start): Update.
(cmd_record_btrace_pt_start): Update.
(cmd_record_btrace_start): Update.
(cmd_record_btrace_start): Update.
* reverse.c (exec_reverse_once): Update.
* python/python.c (execute_gdb_command): Don't copy the command.
* event-top.c (command_line_handler): Update.
(command_handler): Constify.
* defs.h (deprecated_call_command_hook): Constify.
* cli/cli-script.h (execute_user_command): Constify.
* cli/cli-script.c (execute_user_command): Constify.
(execute_cmd_pre_hook, execute_cmd_post_hook): Constify.
(enum command_control_type): Update.
* main.c (catch_command_errors): Remove non-const overload.
(catch_command_errors_ftype): Remove.
* python/py-cmd.c (cmdpy_function): Constify.
* guile/scm-cmd.c (cmdscm_function): Constify.
* cli/cli-dump.c (call_dump_func): Constify.
* cli/cli-decode.c (do_const_cfunc): Constify.
(do_sfunc): Constify.
(cmd_func): Constify.
* gdbcmd.h (execute_command, execute_command_to_string): Constify.
* top.h (execute_command): Constify.
* top.c (execute_command): Constify.
(execute_command_to_string): Constify.
(deprecated_call_command_hook): Constify.
* command.h (cmd_func): Constify.
* cli/cli-decode.h (struct cmd_list_element) <func>: Constify.
Tom Tromey [Sat, 14 Oct 2017 15:07:00 +0000 (09:07 -0600)]
Constify add_setshow_*
This constifies the add_setshow_* family of functions, and then fixes
up the fallout. The bulk of this patch was written by script.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* ada-lang.c (catch_ada_exception_command): Constify.
(catch_assert_command): Constify.
* break-catch-throw.c (catch_catch_command, catch_throw_command)
(catch_rethrow_command): Constify.
(catch_exception_command_1): Constify.
* breakpoint.h (add_catch_command): Constify.
* break-catch-syscall.c (catch_syscall_command_1): Constify.
(catch_syscall_split_args): Constify.
* break-catch-sig.c (catch_signal_command): Constify.
(catch_signal_split_args): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Use
cmd_const_sfunc_ftype.
* cli/cli-decode.c (add_setshow_cmd_full): Constify.
(add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, struct cmd_list_element)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
Constify.
(set_cmd_sfunc): Constify.
(empty_sfunc): Constify.
* command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
Constify.
(set_cmd_sfunc): Constify.
(cmd_sfunc_ftype): Remove.
* compile/compile.c (set_compile_args): Constify.
* infrun.c (set_disable_randomization): Constify.
* infcmd.c (set_args_command, set_cwd_command): Constify.
* breakpoint.c (set_condition_evaluation_mode): Constify.
(add_catch_command): Constify.
(catch_fork_command_1, catch_exec_command_1)
(catch_load_command_1, catch_unload_command_1): Constify.
(catch_load_or_unload): Constify.
* guile/scm-param.c (pascm_set_func): Constify.
(add_setshow_generic): Constify.
* python/py-param.c (get_set_value): Constify.
* top.h (set_verbose): Constify.
* tui/tui-win.c (tui_set_var_cmd): Constify.
* mi/mi-main.c (set_mi_async_command): Constify.
* cli/cli-logging.c (set_logging_overwrite)
(set_logging_redirect): Constify.
* value.c (set_max_value_size): Constify.
* valprint.c (set_input_radix, set_output_radix): Constify.
* utils.c (set_width_command, set_height_command): Constify.
* typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify.
* tracepoint.c (set_disconnected_tracing)
(set_circular_trace_buffer, set_trace_buffer_size)
(set_trace_user, set_trace_notes, set_trace_stop_notes): Constify.
* top.c (set_history_size_command, set_verbose, set_editing)
(set_gdb_datadir, set_history_filename): Constify.
* target.c (set_targetdebug, maint_set_target_async_command)
(maint_set_target_non_stop_command, set_target_permissions)
(set_write_memory_permission): Constify.
(open_target): Constify.
* target-descriptions.c (set_tdesc_filename_cmd): Constify.
* target-dcache.c (set_stack_cache, set_code_cache): Constify.
* symtab.c (set_symbol_cache_size_handler): Constify.
* symfile.c (set_ext_lang_command): Constify.
* symfile-debug.c (set_debug_symfile): Constify.
* source.c (set_directories_command): Constify.
* solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify.
* serial.c (set_parity): Constify.
* rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify.
* remote.c (set_remote_exec_file, set_remotebreak)
(set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify.
* record.c (set_record_insn_history_size)
(set_record_call_history_size): Constify.
* record-full.c (set_record_full_insn_max_num): Constify.
* proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify.
* osabi.c (set_osabi): Constify.
* mips-tdep.c (set_mips64_transfers_32bit_regs)
(reinit_frame_cache_sfunc, mips_abi_update): Constify.
* maint.c (maintenance_set_profile_cmd): Constify.
* linux-thread-db.c (set_libthread_db_search_path): Constify.
* language.c (set_language_command, set_range_command)
(set_case_command): Constify.
* infrun.c (set_non_stop, set_observer_mode)
(set_stop_on_solib_events, set_schedlock_func)
(set_exec_direction_func): Constify.
* infcmd.c (set_inferior_tty_command): Constify.
* disasm.c (set_disassembler_options_sfunc): Constify.
* demangle.c (set_demangling_command): Constify.
* dcache.c (set_dcache_size, set_dcache_line_size): Constify.
* cris-tdep.c (set_cris_version, set_cris_mode)
(set_cris_dwarf2_cfi): Constify.
* corefile.c (set_gnutarget_command): Constify.
* charset.c (set_host_charset_sfunc, set_target_charset_sfunc)
(set_target_wide_charset_sfunc): Constify.
* breakpoint.c (update_dprintf_commands): Constify.
* auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify.
* arm-tdep.c (set_fp_model_sfunc, arm_set_abi)
(set_disassembly_style_sfunc): Constify.
* arch-utils.c (set_endian, set_architecture): Constify.
* alpha-tdep.c (reinit_frame_cache_sfunc): Constify.
* agent.c (set_can_use_agent): Constify.
Tom Tromey [Sat, 14 Oct 2017 04:58:21 +0000 (22:58 -0600)]
Remove cmd_cfunc_ftype
This removes cmd_cfunc_ftype and the non-const overload of add_cmd;
then fixes up the fallout.
For the most part this patch is straightforward. There are a few
files (go32-nat.c, windows-nat.c, and gnu-nat.c) that I could not
compile; so I made a best effort there.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* go32-nat.c (go32_sysinfo, go32_sldt, go32_sgdt, go32_sidt)
(go32_pde, go32_pte, go32_pte_for_address): Constify.
* gnu-nat.c (_parse_bool_arg, show_thread_default_pause_cmd)
(set_thread_default_pause_cmd, set_thread_default_run_cmd)
(show_thread_default_run_cmd, set_thread_default_detach_sc_cmd)
(parse_int_arg, show_thread_default_detach_sc_cmd)
(set_signals_cmd, show_signals_cmd, set_sig_thread_cmd)
(show_sig_thread_cmd, set_stopped_cmd, show_stopped_cmd)
(set_exceptions_cmd, show_exceptions_cmd, set_task_pause_cmd)
(show_task_pause_cmd, set_task_detach_sc_cmd)
(show_task_detach_sc_cmd, set_task_exc_port_cmd)
(set_noninvasive_cmd, set_thread_pause_cmd)
(show_thread_pause_cmd, set_thread_run_cmd, show_thread_run_cmd)
(set_thread_detach_sc_cmd, show_thread_detach_sc_cmd)
(set_thread_exc_port_cmd, thread_takeover_sc_cmd): Constify.
* windows-nat.c (display_selectors): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Remove
non-const "cfunc".
* cli/cli-decode.c (set_cmd_cfunc): Remove non-const overload.
(cmd_cfunc_eq): Likewise.
(struct cmd_list_element): Likewise.
(do_cfunc): Remove.
(cli_user_command_p): Update.
* command.h (add_cmd): Remove non-const overload.
(cmd_cfunc_ftype): Remove typedef.
(cmd_cfunc_eq): Remove non-const overload.
* value.c (show_values): Constify.
* thread.c (thread_apply_all_command): Constify.
* symfile.c (load_command): Constify.
* source.c (directory_command): Constify.
* maint.c (maintenance_internal_error)
(maintenance_demangler_warning, maintenance_space_display)
(maintenance_print_architecture, maintenance_translate_address)
(maintenance_info_selftests, maintenance_internal_warning):
Constify.
* breakpoint.c (disable_trace_command, enable_trace_command):
Constify.
* auto-load.c (info_auto_load_local_gdbinit, add_auto_load_dir):
Constify.
(add_auto_load_safe_path): Constify.
* guile/scm-auto-load.c (info_auto_load_guile_scripts): Constify.
* top.h (show_commands): Constify.
* linux-thread-db.c (info_auto_load_libthread_db): Constify.
* sparc64-tdep.c (adi_examine_command): Constify.
(adi_assign_command): Constify.
Tom Tromey [Sat, 14 Oct 2017 04:07:26 +0000 (22:07 -0600)]
Constify add_info
This patch constifies add_info and updates all the info commands. The
bulk of this patch was written using a script; and then I did a manual
pass to fix up the remaining compilation errors.
I could not compile every changed file; in particular nto-procfs.c,
gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the
correctness by inspection.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* frame.h (info_locals_command, info_args_command): Constify.
* auto-load.h (auto_load_info_scripts): Constify.
* inferior.h (registers_info): Constify.
* copying.c: Rebuild.
* copying.awk: Constify generated commands.
* auto-load.c (auto_load_info_scripts)
(info_auto_load_gdb_scripts): Constify.
* cli/cli-decode.c (struct cmd_list_element): Take a
cmd_const_cfunc_ftype.
* command.h (add_info): Take a cmd_const_cfunc_ftype.
* tui/tui-win.c (tui_all_windows_info): Constify.
* python/py-auto-load.c (info_auto_load_python_scripts):
Constify.
* cli/cli-cmds.c (show_command): Remove non-const overload.
* tracepoint.c (info_tvariables_command, info_scope_command):
Constify.
(info_static_tracepoint_markers_command): Constify.
* thread.c (info_threads_command): Constify.
(print_thread_info_1): Constify.
* target.c (info_target_command): Constify.
* symtab.c (info_sources_command, info_functions_command)
(info_types_command): Constify.
(info_variables_command): Remove non-const overload.
* symfile.c (info_ext_lang_command): Constify.
* stack.c (info_frame_command, info_locals_command)
(info_args_command): Constify.
(backtrace_command): Remove non-const overload.
* source.c (info_source_command, info_line_command): Constify.
* solib.c (info_sharedlibrary_command): Constify.
* skip.c (info_skip_command): Constify.
* ser-go32.c (info_serial_command): Constify.
* reverse.c (info_bookmarks_command): Constify.
* printcmd.c (info_symbol_command, info_address_command)
(info_display_command): Constify.
* osdata.c (info_osdata_command): Constify.
* objc-lang.c (info_selectors_command, info_classes_command):
Constify.
* nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify.
* memattr.c (info_mem_command): Constify.
* macrocmd.c (info_macro_command, info_macros_command): Constify.
* linux-fork.c (info_checkpoints_command): Constify.
* infrun.c (info_signals_command): Constify.
* inflow.c (info_terminal_command): Constify.
* inferior.c (info_inferiors_command): Constify.
(print_inferior): Constify.
* infcmd.c (info_program_command, info_all_registers_command)
(info_registers_command, info_vector_command)
(info_float_command): Constify.
(registers_info): Constify.
* gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd)
(info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd):
Constify.
* f-valprint.c (info_common_command): Constify.
* dcache.c (info_dcache_command): Constify.
(dcache_info_1): Constify.
* darwin-nat-info.c (info_mach_tasks_command)
(info_mach_task_command, info_mach_ports_command)
(info_mach_port_command, info_mach_threads_command)
(info_mach_thread_command, info_mach_regions_command)
(info_mach_regions_recurse_command, info_mach_region_command)
(info_mach_exceptions_command): Constify.
(get_task_from_args): Constify.
* cp-support.c (info_vtbl_command): Constify.
* breakpoint.c (info_watchpoints_command)
(info_tracepoints_command): Constify.
(info_breakpoints_command): Remove non-const overload.
* avr-tdep.c (avr_io_reg_read_command): Constify.
* auxv.c (info_auxv_command): Constify.
* ada-tasks.c (info_tasks_command): Constify.
(info_task): Constify.
* ada-lang.c (info_exceptions_command): Constify.
Tom Tromey [Wed, 11 Oct 2017 21:43:01 +0000 (15:43 -0600)]
Constify add_com
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes
up all the command implementations.
In most cases this is trivial.
In a couple of places I had to again introduce a temporary non-const
overload. These overloads will be removed when add_info is
constified.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* solib.h (no_shared_libraries): Constify.
* frame.h (return_command): Constify.
* cli/cli-cmds.h (quit_command): Constify.
* top.h (quit_command, execute_command): Constify.
* target.h (flash_erase_command): Constify.
* inferior.h (set_inferior_args, attach_command): Constify.
* tracepoint.h (start_tracing, stop_tracing): Constify.
* breakpoint.h (break_command, tbreak_command)
(hbreak_command_wrapper, thbreak_command_wrapper)
(rbreak_command_wrapper, watch_command_wrapper)
(awatch_command_wrapper, rwatch_command_wrapper)
(get_tracepoint_by_number): Constify.
* symtab.c (info_variables_command, rbreak_command)
(symtab_symbol_info): Constify.
(info_variables_command): Add non-const overload.
* top.c (dont_repeat_command): Constify.
* breakpoint.c (ignore_command, commands_command)
(condition_command, tbreak_command, hbreak_command)
(thbreak_command, clear_command, break_command)
(info_breakpoints_command, watch_command, rwatch_command)
(awatch_command, trace_command, ftrace_command, strace_command)
(trace_pass_command, break_range_command, dprintf_command)
(agent_printf_command, get_tracepoint_by_number)
(watch_maybe_just_location, trace_pass_command): Constify.
(info_breakpoints_command): Add non-const overload.
* tracefile.c (tsave_command): Constify.
* infcmd.c (attach_command, disconnect_command, signal_command)
(queue_signal_command, stepi_command, nexti_command)
(finish_command, next_command, step_command, until_command)
(advance_command, jump_command, continue_command, run_command)
(start_command, starti_command, interrupt_command)
(run_command_1, set_inferior_args, step_1): Constify.
* inferior.c (add_inferior_command, remove_inferior_command)
(clone_inferior_command): Constify.
* linux-fork.c (checkpoint_command, restart_command): Constify.
* windows-nat.c (signal_event_command): Constify.
* guile/guile.c (guile_repl_command, guile_command): Constify.
* printcmd.c (x_command, display_command, printf_command)
(output_command, set_command, call_command, print_command)
(eval_command): Constify.
(non_const_set_command): Remove.
(_initialize_printcmd): Update.
* source.c (forward_search_command, reverse_search_command):
Constify.
* jit.c (jit_reader_load_command, jit_reader_unload_command):
Constify.
* infrun.c (handle_command): Constify.
* memattr.c (mem_command): Constify.
* stack.c (return_command, up_command, up_silently_command)
(down_command, down_silently_command, frame_command)
(backtrace_command, func_command, backtrace_command_1): Constify.
(backtrace_command): Add non-const overload.
* remote-sim.c (simulator_command): Constify.
* exec.c (set_section_command): Constify.
* tracepoint.c (tdump_command, trace_variable_command)
(tstatus_command, tstop_command, tstart_command)
(end_actions_pseudocommand, while_stepping_pseudocommand)
(collect_pseudocommand, teval_pseudocommand, actions_command)
(start_tracing, stop_tracing): Constify.
* value.c (init_if_undefined_command): Constify.
* tui/tui-stack.c (tui_update_command): Constify.
* tui/tui-win.c (tui_refresh_all_command)
(tui_set_tab_width_command, tui_set_win_height_command)
(tui_set_focus_command, tui_scroll_forward_command)
(tui_scroll_backward_command, tui_scroll_left_command)
(tui_scroll_right_command, parse_scrolling_args, tui_set_focus)
(tui_set_win_height): Constify.
* tui/tui-layout.c (tui_layout_command): Constify.
* procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd)
(proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd)
(proc_untrace_sysexit_cmd): Constify.
* remote.c (threadlist_test_cmd, threadinfo_test_cmd)
(threadset_test_cmd, threadlist_update_test_cmd)
(threadalive_test): Constify.
* objc-lang.c (print_object_command): Constify.
* command.h (add_com): Constify.
* cli/cli-dump.c (restore_command): Constify.
* cli/cli-cmds.c (pwd_command, echo_command, quit_command)
(help_command, complete_command, shell_command, edit_command)
(list_command, disassemble_command, make_command)
(apropos_command, alias_command): Constify.
* cli/cli-script.c (document_command, define_command)
(while_command, if_command, validate_comname): Constify.
* cli/cli-decode.c (struct cmd_list_element): Change type of
"fun".
* target.c (do_monitor_command, flash_erase_command): Constify.
* regcache.c (reg_flush_command): Constify.
* reverse.c (reverse_step, reverse_next, reverse_stepi)
(reverse_nexti, reverse_continue, reverse_finish)
(save_bookmark_command, goto_bookmark_command)
(exec_reverse_once): Constify.
* python/python.c (python_interactive_command, python_command):
Constify.
* typeprint.c (ptype_command, whatis_command, whatis_exp):
Constify.
* solib.c (sharedlibrary_command, no_shared_libraries): Constify.
* gcore.c (gcore_command): Constify.
Tom Tromey [Thu, 12 Oct 2017 14:27:21 +0000 (08:27 -0600)]
Add set_repeat_arguments function
The "x", "list", and "show commands" commands have special repetition
behavior: repeating the command doesn't re-run it with the same
arguments
This is currently implemented by modifying the passed-in argument; but
that won't work properly with const arguments (and seems pretty
obscure besides).
This patch adds a new "set_repeat_arguments" function and changes the
relevant places to call it.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* printcmd.c (x_command): Call set_repeat_arguments.
* cli/cli-cmds.c (list_command): Call set_repeat_arguments.
* top.c (repeat_arguments): New global.
(set_repeat_arguments): New function.
(execute_command): Handle repeat_arguments.
(show_commands): Calls set_repeat_arguments.
* command.h (set_repeat_arguments): Declare.
Tom Tromey [Thu, 12 Oct 2017 14:08:00 +0000 (08:08 -0600)]
Remove cleanup from backtrace_command
This removes a cleanup from backtrace_command, replacing it with
std::string. This patch temporarily changes backtrace_command so that
the parameter is named "args_in" and is immediately constified; this
is fixed again in the constification patch.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command): Use std::string.
(backtrace_command_1): Make "count_exp" const.
Tom Tromey [Wed, 11 Oct 2017 23:04:29 +0000 (17:04 -0600)]
Constify add_path and friends
This constifies add_path, mod_path, and directory_switch.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* source.c (directory_switch, mod_path, add_path): Constify.
* defs.h (add_path, mod_path, directory_switch): Constify.
* mi/mi-cmd-env.c (env_mod_path): Constify.
Tom Tromey [Wed, 11 Oct 2017 03:54:01 +0000 (21:54 -0600)]
Make strip_bg_char return a unique_xmalloc_ptr
This changes strip_bg_char to return a unique_xmalloc_ptr and removes
several cleanups.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* infcmd.c (strip_bg_char): Return gdb::unique_xmalloc_ptr.
(run_command_1, continue_command, step_1, jump_command)
(signal_command, until_command, advance_command, finish_command)
(attach_command): Update.
Tom Tromey [Wed, 11 Oct 2017 00:14:10 +0000 (18:14 -0600)]
Make set_cmd_cfunc private
set_cmd_cfunc is only used in cli-decode.c, and I don't think there is
a good reason to expose it directly. So, this patch makes it private.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* command.h (set_cmd_cfunc): Don't declare.
* cli/cli-decode.c (set_cmd_cfunc): Now static.
Tom Tromey [Wed, 11 Oct 2017 00:12:06 +0000 (18:12 -0600)]
Constify add_com_suppress_notification
This constifies add_com_suppress_notification and fixes the one
caller.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* stack.c (select_frame_command): Constify.
* cli/cli-decode.c (add_com_suppress_notification): Constify.
* command.h (add_com_suppress_notification): Constify.
Tom Tromey [Tue, 10 Oct 2017 23:51:52 +0000 (17:51 -0600)]
Constify add_abbrev_prefix_cmd
This changes add_abbrev_prefix_cmd to take a const-taking callback
function and then fixes the one caller.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* breakpoint.c (stop_command): Constify.
* cli/cli-decode.c (struct cmd_list_element): Constify.
* command.h (add_abbrev_prefix_cmd): Constify.
Andrew Burgess [Tue, 7 Nov 2017 20:24:21 +0000 (20:24 +0000)]
opcodes/arc: Fix incorrect insn_class for some nps insns
A small number of NPS400 instruction incorrectly used NONE as an
insn_class_t, which would trigger a build warning. Fixed by changing to
MISC.
opcodes/ChangeLog:
* arc-nps400-tbl.h: Change incorrect use of NONE to MISC.
Jim Wilson [Tue, 7 Nov 2017 17:43:18 +0000 (09:43 -0800)]
Fix typo in my email address.
binutils/
* MAINTAINERS (RISC-V): Fix typo in my email address.
Palmer Dabbelt [Tue, 7 Nov 2017 01:53:12 +0000 (17:53 -0800)]
RISC-V: Add Jim Wilson as a maintainer, and clean up our entries
Jim has recently started working at SiFive, where he'll be contributing
to our binutils port. Andrew and I would like him to be a maintainer.
My understanding is that this is right place to ask.
I've also changed my address to my SiFive one, where I also work -- it
seems cleaner to have everyone use our proper email address. While I
was in there, I noticed a trailing space after Andrew's name so I went
ahead and removed it as well.
binutils/ChangeLog
2017-11-07 Palmer Dabbelt <palmer@sifive.com>
* MAINTAINERS (RISC-V): Add Jim Wilson as a maintainer.
Clean up Andrew's entry (remove trailing space, add tabs).
Change Palmer's email address, and clean up entry (add tabs).
Jim Wilson [Tue, 7 Nov 2017 00:32:08 +0000 (16:32 -0800)]
RISC-V: Fix riscv g++ testsuite EH failures.
This fixes some EH failures for the medany code model in the g++ testsuite.
The problem is that the assembler is computing some values in the eh_frame
section as constants, that instead should have had relocs to be resolved by
the linker. This happens in output_cfi_insn in the DW_CFA_advance_loc case
where it compares label frags and immediately simplifies if they are the
same. We can fix that by forcing a new frag after every instruction
that the linker can reduce in size. I've also added a testcase to verify
the fix. This was tested with binutils make check, and gcc/g++ make checks on
qemu for medlow and medany code models.
gas/
* config/tc-riscv.c (append_insn): Call frag_wane and frag_new at
end for linker optimizable relocs.
* testsuite/gas/riscv/eh-relocs.d: New.
* testsuite/gas/riscv/eh-relocs.s: New.
* testsuite/gas/riscv/riscv.exp: Run eh-relocs test.
Palmer Dabbelt [Mon, 6 Nov 2017 21:22:42 +0000 (13:22 -0800)]
RISC-V: Add satp as an alias for sptbr
The RISC-V privileged ISA changed the name of sptbr (Supervisor Page
Table Base Register) to satp (Supervisor Address Translation and
Protection) to reflect the fact it could be used for more than just
paging. This patch adds an alias, as they're the same register.
include/ChangeLog
2017-11-06 Palmer Dabbelt <palmer@dabbelt.com>
* opcode/riscv-opc.h (sptbr): Rename to satp.
(CSR_SPTBR): Rename to CSR_SATP.
(sptbr): Alias to CSR_SATP.
gas/ChangeLog
2017-11-06 Palmer Dabbelt <palmer@dabbelt.com>
* testsuite/gas/riscv/satp.d: New test.
testsuite/gas/riscv/satp.s: Likewise.
testsuite/gas/riscv/riscv.exp: Likewise.
config/tc-riscv.c (md_begin): Handle CSR aliases.
Pedro Alves [Tue, 7 Nov 2017 11:16:09 +0000 (11:16 +0000)]
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.
Pedro Alves [Tue, 7 Nov 2017 11:00:32 +0000 (11:00 +0000)]
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.
Pedro Alves [Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)]
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.
Pedro Alves [Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)]
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:".
Xavier Roirand [Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)]
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.
Tamar Christina [Tue, 7 Nov 2017 10:17:21 +0000 (10:17 +0000)]
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.
Alan Modra [Mon, 6 Nov 2017 04:51:53 +0000 (15:21 +1030)]
PowerPC64 statistics message
Fixes "linker stubs in 1 groups".
* elf64-ppc.c (ppc64_elf_build_stubs): Correct pluralization in
statistics message.
Alan Modra [Tue, 7 Nov 2017 06:02:07 +0000 (16:32 +1030)]
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.
Alan Modra [Tue, 7 Nov 2017 00:48:29 +0000 (11:18 +1030)]
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.
Alan Modra [Mon, 6 Nov 2017 09:14:02 +0000 (19:44 +1030)]
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.
Alan Modra [Mon, 6 Nov 2017 11:00:12 +0000 (21:30 +1030)]
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.
Alan Modra [Mon, 6 Nov 2017 04:50:00 +0000 (15:20 +1030)]
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.
GDB Administrator [Tue, 7 Nov 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Luis Machado [Mon, 6 Nov 2017 17:39:09 +0000 (15:39 -0200)]
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.
Pedro Alves [Mon, 6 Nov 2017 15:36:47 +0000 (15:36 +0000)]
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.
Pedro Alves [Mon, 6 Nov 2017 15:36:47 +0000 (15:36 +0000)]
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.
Pedro Alves [Mon, 6 Nov 2017 16:19:12 +0000 (16:19 +0000)]
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.
Pedro Alves [Mon, 6 Nov 2017 15:36:47 +0000 (15:36 +0000)]
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.
Pedro Alves [Mon, 6 Nov 2017 15:36:46 +0000 (15:36 +0000)]
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.
Pedro Alves [Mon, 6 Nov 2017 15:36:46 +0000 (15:36 +0000)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 15:04:03 +0000 (16:04 +0100)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 15:02:33 +0000 (16:02 +0100)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 15:01:37 +0000 (16:01 +0100)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 15:00:47 +0000 (16:00 +0100)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 14:59:36 +0000 (15:59 +0100)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 14:58:46 +0000 (15:58 +0100)]
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.
Ulrich Weigand [Mon, 6 Nov 2017 14:57:31 +0000 (15:57 +0100)]
Target FP: Add conversion routines to target-float.{c,h}
This patch adds the following conversion routines:
- target_float_to_longest
- target_float_from_longest
- target_float_from_ulongest
- target_float_convert
which call the equivalent decimal_ routines to handle decimal FP,
and call helper routines that currently still go via DOUBLEST to
handle binary FP.
The target_float_convert routine not only handles BFP<->BFP and
DFP<->DFP conversions, but also BFP<->DFP, which are implemented
by converting to a string and back.
These helpers are used in particular to implement conversion
from and to FP in value_cast, without going through DOUBLEST there.
In order to implement this for the FP<-integer case, the
pack_long / pack_unsigned_long routines are extended to support
floating-point values as output (thereby allowing use of
value_from_[u]longest with a floating-point target type).
This latter change also allows simplification of value_one.
gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c (floatformat_to_longest): New function.
(floatformat_from_longest, floatformat_from_ulongest): Likewise.
(floatformat_convert): Likewise.
(target_float_to_longest): Likewise.
(target_float_from_longest, target_float_from_ulongest): Likewise.
(target_float_convert): Likewise.
* target-float.h (target_float_to_longest): Add prototype.
(target_float_from_longest, target_float_from_ulongest): Likewise.
(target_float_convert): Likewise.
* value.c (unpack_long): Use target_float_to_longest.
(pack_long): Allow FP types. Use target_float_from_longest.
(pack_unsigned_long): Likewise using target_float_from_ulongest.
* valops.c: Include "target-float.h". Do not include "dfp.h".
(value_cast): Handle conversions to FP using target_float_convert,
value_from_ulongest, and value_from_longest.
(value_one): Use value_from_longest for FP types as well.
Ulrich Weigand [Mon, 6 Nov 2017 14:56:35 +0000 (15:56 +0100)]
Target FP: Add string routines to target-float.{c,h}
This adds target_float_to_string and target_float_from_string,
which dispatch to the corresponding floatformat_ or decimal_ routines.
Existing users of those routines are changed to use the new
target-float routines instead (most of those places already handle
both binary and decimal FP).
In addition, two other places are changes to use target_float_from_string:
- define_symbol in stabsread.c, when parsing a floating-point literal
from stabs debug info
- gdbarch-selftest.c when initializing a target format values (to
eliminate use of DOUBLEST there).
gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c (target_float_to_string): New function.
(target_float_from_string): New function.
* target-float.h (target_float_to_string): Add prototype.
(target_float_from_string): Add prototype.
* valprint.c: Include "target-float.h". Do not include
"doublest.h" and "dfp.h".
(print_floating): Use target_float_to_string.
* printcmd.c: Include "target-float.h". Do not include "dfp.h".
(printf_floating): Use target_float_to_string.
* i387-tdep.c: Include "target-float.h". Do not include "doublest.h".
(print_i387_value): Use target_float_to_string.
* mips-tdep.c: Include "target-float.h".
(mips_print_fp_register): Use target_float_to_string.
* sh64-tdep.c: Include "target-float.h".
(sh64_do_fp_register): Use target_float_to_string.
* parse.c: Include "target-float.h". Do not include
"doublest.h" and "dfp.h".
(parse_float): Use target_float_from_string.
* stabsread.c: Include "target-float.h". Do not include "doublest.h".
(define_symbol): Use target_float_from_string.
* gdbarch-selftests.c: Include "target-float.h".
(register_to_value_test): Use target_float_from_string.
Ulrich Weigand [Mon, 6 Nov 2017 14:55:11 +0000 (15:55 +0100)]
Target FP: Introduce target-float.{c,h}
This patch introduces the new set of target floating-point handling routines
in target-float.{c,h}. In the end, the intention is that this file will
contain support for all operations in target FP format, fully replacing
both the current doublest.{c,h} and dfp.{c,h}.
To begin with, this patch only adds a target_float_is_zero routine,
which handles the equivalent of decimal_is_zero for both binary and
decimal FP. For the binary case, to avoid conversion to DOUBLEST,
this is implemented using the floatformat_classify routine.
However, it turns out that floatformat_classify actually has a bug
(it was not used to check for zero before), so this is fixed as well.
The new routine is used in both value_logical_not and valpy_nonzero.
There is one extra twist: the code previously used value_as_double
to convert to DOUBLEST and then compare against zero. That routine
performs an extra task: it detects invalid floating-point values
and raises an error. In any place where value_as_double is removed
in favor of some target-float.c routine, we need to replace that check.
To keep this check centralized in one place, I've added a new routine
is_floating_value, which returns a boolean determining whether a
value's type is floating point (binary or decimal), and if so, also
performs the validity check. Since we need to check whether a value
is FP before calling any of the target-float routines anyway, this
seems a good place to add the check without much code size overhead.
In some places where we only want to check for floating-point types
and not perform a validity check (e.g. for the *output* of an operation),
we can use the new is_floating_type routine (in gdbarch) instead.
The validity check itself is done by a new target_float_is_valid
routine in target-float, encapsulating floatformat_is_valid.
ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* Makefile.c (SFILES): Add target-float.c.
(HFILES_NO_SRCDIR): Add target-float.h.
(COMMON_OBS): Add target-float.o.
* target-float.h: New file.
* target-float.c: New file.
* doublest.c (floatformat_classify): Fix detection of float_zero.
* gdbtypes.c (is_floating_type): New function.
* gdbtypes.h (is_floating_type): Add prototype.
* value.c: Do not include "floatformat.h".
(unpack_double): Use target_float_is_valid.
(is_floating_value): New function.
* value.h (is_floating_value): Add prototype-
* valarith.c: Include "target-float.h".
(value_logical_not): Use target_float_is_zero.
* python/py-value.c: Include "target-float.h".
(valpy_nonzero): Use target_float_is_zero.
GDB Administrator [Mon, 6 Nov 2017 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sun, 5 Nov 2017 09:22:13 +0000 (19:52 +1030)]
Proper bound check in _bfd_doprnt_scan
While an abort after storing out of bounds by one to an array in our
caller is probably OK in practice, it's better to check before storing.
PR 22397
* bfd.c (_bfd_doprnt_scan): Check args index before storing, not
after.
Alan Modra [Sun, 5 Nov 2017 05:52:55 +0000 (16:22 +1030)]
PR22397, BFD internal error when message locale isn't C
This adds positional parameter support to the bfd error handler,
something that was lost 2017-04-13 when _doprnt was added with commit
c08bb8dd. The number of format args is now limited to 9, which is
sufficient for current _bfd_error_handler messages. If someone
exceeds 9 args they get the joy of modifying this code to support more
args (shouldn't be too difficult).
PR 22397
* bfd.c (union _bfd_doprnt_args): New.
(PRINT_TYPE): Add FIELD arg. Take value from args.
(_bfd_doprnt): Replace ap parameter with args. Adjust all
PRINT_TYPE invocations and reading of format args to suit.
Move "%%" handling out of switch handling args. Support
positional parameters.
(_bfd_doprnt_scan): New function.
(error_handler_internal): Call _bfd_doprnt_scan and read args.
GDB Administrator [Sun, 5 Nov 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 4 Nov 2017 03:11:29 +0000 (13:41 +1030)]
powerpc TLS in PIEs
This patch removes unnecessary GOT IE TLS relocations in PIEs. Useful
with --no-tls-optimize, or with an enormous TLS segment. With the
default --tls-optimize in effect IE code sequences will be edited to
LE under the same circumstances we can remove the GOT reloc.
* elf32-ppc.c (got_entries_needed, got_relocs_needed): New functions.
(allocate_dynrelocs, ppc_elf_size_dynamic_sections): Use them here.
(ppc_elf_relocate_section): Don't output a dynamic relocation
for IE GOT entries in an executable.
* elf64-ppc.c (allocate_got): Trim unnecessary TPREL relocs.
(ppc64_elf_size_dynamic_sections): Likewise.
(ppc64_elf_relocate_section): Likewise.
Alan Modra [Wed, 1 Nov 2017 21:35:03 +0000 (08:05 +1030)]
PowerPC readonly_dynrelocs
PowerPC64 lacked the mapfile textrel warning on finding dynamic relocs
in read-only sections. This patch adds it, and tidies the
readonly_dynrelocs interface. PowerPC doesn't need a SEC_ALLOC test
because !SEC_ALLOC sections are excluded by check_relocs so will never
have dyn_relocs.
* elf32-ppc.c (readonly_dynrelocs): Delete info param. Update all
callers. Don't bother with SEC_ALLOC test. Return section pointer.
Move minfo call to..
(maybe_set_textrel): ..here.
* elf64-ppc.c (readonly_dynrelocs): Return section pointer.
(maybe_set_textrel): Call minfo to print textrel warning to map file.
Alan Modra [Thu, 2 Nov 2017 01:39:34 +0000 (12:09 +1030)]
hppa-linux TLS relocs
This patch fixes various problems with TLS relocations.
1) Report an error if a symbol has both TLS and normal GOT entries.
2) The GOT entry size calculation was obscure and made use of the fact
that a symbol shouldn't have both normal and TLS GOT entries.
3) The second word of a GD GOT entry sometimes omitted a dynamic
reloc, which was fine except that doing so makes it impossible for
ld.so to differentiate GD and LD entries. Also, a NONE reloc was
emitted.
4) Unnecessary relocs were emitted for GOT entries.
5) GOT relocs didn't take note of UNDEFWEAK_NO_DYNAMIC_RELOC.
* elf32-hppa.c (enum _tls_type): Move.
(struct elf32_hppa_link_hash_entry): Make tls_type a bitfield.
(elf32_hppa_check_relocs): Set DF_STATIC_TLS only for shared libraries.
Tidy tls_type handling. Set symbol tls_type for GOT_TLS_LDM too.
(got_entries_needed, got_relocs_needed): New functions.
(allocate_dynrelocs): Use them.
(elf32_hppa_size_dynamic_sections): Likewise.
(elf32_hppa_relocate_section): Delete bogus FIXME. Formatting.
Correct code emitting relocs on GD/IE got entries. Report an
error when a symbol has both normal and TLS GOT relocs.
Alan Modra [Tue, 31 Oct 2017 07:43:03 +0000 (18:13 +1030)]
PR22394, hppa-linux-ld fails to emit dynamic relocations
gcc -mfast-indirect-calls emits a function pointer initialization
without a P% (plabel) modifier. ld does not create the necessary
dynamic relocations for this to work. It turns out that the problem
is caused by the non_got_ref symbol flag. This flag is set for
non-pic by check_relocs to indicate that the symbol might need copy
relocations or dynamic relocations. Later, the backend
adjust_dynamic_symbol clears the flag to indicate dynamic relocations
are needed, but leaves it set when copy relocations were created. The
inversion in meaning is insane, but it's that way because the backend
adjust_dynamic_symbol function doesn't get to look at all symbols..
Anyway, the insanity works for non-function symbols. However, the
flag is left set on any function symbol with a dynamic relocation.
This patch fixes the non_got_ref handling for function symbols, adds
-z nocopyreloc for hppa-elf, reports where textrel occurs, and expands
comments. The check_relocs change just stops creation of dyn_relocs
we always threw away later.
PR 22394
* elf32-hppa.c (elf32_hppa_check_relocs): Don't create dyn_relocs
for plabels when non-pic.
(maybe_set_textrel): New function.
(readonly_dynrelocs): Move and rewrite.
(elf32_hppa_adjust_dynamic_symbol): Use it. Don't create copy
relocs when def_regular or -z nocopyreloc. Handle non_got_ref
for functions. Expand non_got_ref comments.
(elf32_hppa_size_dynamic_sections): Use maybe_set_textrel.
Tom Tromey [Thu, 2 Nov 2017 04:46:40 +0000 (22:46 -0600)]
Use std::vector in h8300-tdep.c
This changes h8300-tdep.c to use std::vector, allowing the removal of
a cleanup.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* h8300-tdep.c (h8300_push_dummy_call): Use std::vector.
Tom Tromey [Thu, 2 Nov 2017 04:32:45 +0000 (22:32 -0600)]
Introduce gdb_breakpoint_up
This introduces gdb_breakpoint_up, a unique_ptr typedef that owns a
breakpoint. It then changes set_momentary_breakpoint to return a
gdb_breakpoint_up and fixes up the fallout. This then allows the
removal of make_cleanup_delete_breakpoint.
Once breakpoints are fully C++-ified, this typedef can be removed in
favor of a plain std::unique_ptr.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* breakpoint.c (set_momentary_breakpoint): Return
breakpoint_up.
(until_break_command): Update.
(new_until_break_fsm): Change argument types to
breakpoint_up.
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(do_delete_breakpoint_cleanup, make_cleanup_delete_breakpoint):
Remove.
* infcmd.c (finish_forward): Update.
* breakpoint.h (set_momentary_breakpoint)
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(make_cleanup_delete_breakpoint): Remove.
(struct breakpoint_deleter): New.
(breakpoint_up): New typedef.
* infrun.c (insert_step_resume_breakpoint_at_sal_1): Update.
(insert_exception_resume_breakpoint): Update.
(insert_exception_resume_from_probe): Update.
(insert_longjmp_resume_breakpoint): Update.
* arm-linux-tdep.c (arm_linux_copy_svc): Update.
* elfread.c (elf_gnu_ifunc_resolver_stop): Update.
* infcall.c (call_function_by_hand_dummy): Update