This is a regression from 7.5, introduced/exposed by:
http://sourceware.org/ml/gdb-patches/2012-07/msg00259.html
There are a series of issues with this code.
It does:
unsigned int val = parse_and_eval_long (arg);
^^^^^^^^^^^^
(unsigned, usually 32-bit) while parse_and_eval_long returns a LONGEST
(usually 64-bit), so we lose precision without noticing:
(gdb) set remote hardware-watchpoint-limit 0x100000000
(gdb) show remote hardware-watchpoint-limit 0x100000000
The maximum number of target hardware watchpoints is 0.
While at it, print the invalid number with plongest, so the user sees
what GDB thought the number was:
(gdb) set remote hardware-watchpoint-limit 0x100000000
integer 4294967296 out of range
So with "set remote hardware-watchpoint-limit -1", val ends converted
to 0xffffffff, which then fails the
else if (val >= INT_MAX)
error (_("integer %u out of range"), val);
test.
Looking at that INT_MAX check, we forbid INT_MAX itself, but we
shouldn't, as that does fit in 'int' -- we want to forbid values
_greater_ than INT_MAX (and less than INT_MIN, while at it):
(gdb) set remote hardware-watchpoint-limit 2147483647
integer 2147483647 out of range
The same problem is in the new var_zuinteger_unlimited code, which
also uses "int" for variable.
Also, when printing a 'signed int', we should use %d, not %u.
This adds a couple regression tests. Not completely thorough in checking
all kinds of invalid input; I'm saving more exaustive testing around
zXXinteger commands for something like new test-assisting commands
like "maint test cmd-zinteger -1", where testing would focus on the
command types, and thus be independent of particular user commands of
particular GDB features.
Tested on x86_64 Fedora 17.
gdb/
2013-03-20 Pedro Alves <palves@redhat.com>
PR gdb/15289
* cli/cli-setshow.c (do_set_command)
<var_uinteger, var_zuinteger>: Use LONGEST for variable holding
the result of parsing the command argument. Throw error if the
value is greater than UINT_MAX. Print the invalid value with
plongest.
<var_integer, var_zinteger>: Use LONGEST for variable holding the
result of parsing the command argument. Throw error if the value
is greater than INT_MAX, not greater or equal. Also throw error
if the value is less than INT_MIN. Print the invalid value with
plongest.
<var_zuinteger_unlimited>: Throw error if the value is greater
than INT_MAX, not greater or equal.
(do_show_command) <var_integer, var_zinteger,
var_zuinteger_unlimited>: Use %d for printing int, not %u.
gdb/testsuite/
2013-03-20 Pedro Alves <palves@redhat.com>
PR gdb/15289
* gdb.base/remote.exp: Test
"set remote hardware-watchpoint-limit -1",
"set remote hardware-breakpoint-limit -1",
"set remote hardware-watchpoint-limit 2147483647" and
"set remote hardware-breakpoint-limit 2147483647".
* tic6x-opcode-table.h: Rename mpydp's specific operand type macro
from ORREGD1324 to ORXREGD1324 and make it cross-path-able through
tic6x_operand_xregpair operand coding type.
Make mpydp instruction cross-path-able, ie: remove the FIXed 'x'
opcode field, usu ORXREGD1324 for the src2 operand and remove the
TIC6X_FLAG_NO_CROSS.
* gas/tic6x/insns-bad-1.s: Remove test-case for mpydp with
cross-path.
* gas/tic6x/insns-bad-1.l: Update expected output.
* gas/tic6x/insns-c674x.s: Add a test-case for mpydp with
cross-path.
* gas/tic6x/insns-c674x.d: Update expected output.
order to encode separately the msb and lsb of a register pair ; this will be
needed to encode the opcodes the same
way as Ti assembler does.
* gas/config/tc-tic6x.c: handle tic6x_coding_dreg_(msb|lsb) field coding types
and use it to encode register pair numbers when required.
* opcodes/tic6x-dis.c: decodes opcodes that have individual msb and lsb halves
in src1 & src2 fields ; discard the src1 (lsb) value and only use src2 (msb),
discarding bit 0, to follow what Ti SDK does in that case as any value in the
src1 field yields the same output with SDK disassembler.
* include/opcode/tic6x-opcode-table.h: modify absdp, dpint, dpsp, dptrunc,
rcpdp and rsqrdp opcodes to use the new field coding types.
* gas/testsuite/gas/tic6x/insns-c674x.d, gas/testsuite/gas/tic6x/insns-c674x.s
: add test case for the newly generated opcode but keep the old ones as they
seem legit as per Ti disassembler output.
2013-03-20 Will Newton <will.newton@linaro.org>
* ld-elfvers/vers.exp (objdump_symstuff): Sort objdump output
based on the symbol name rather than address.
* ld-elfvers/vers1.sym: Reorder contents to match changes to vers.exp.
* ld-elfvers/vers15.sym: Likewise.
* ld-elfvers/vers18.sym: Likewise.
* ld-elfvers/vers21.sym: Likewise.
* ld-elfvers/vers9.sym: Likewise.
Make sure we don't fallback to printing the initial value of a
non-const variable in the executable.
Also make sure we can do 'disassemble', as another test that GDB is
able to read read-only parts from the executable (the existing test of
printing constglob also covers that case).
gdb/testsuite/
2013-03-20 Pedro Alves <palves@redhat.com>
Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c: Add comments.
(nonconstglob): New global.
* gdb.trace/tfile.exp: Add comments. Test printing a non-const
global that is not covered by the trace frame. Test
disassembling.
* elflink.c (_bfd_elf_make_dynamic_reloc_section): Override
sh_type according to is_rela.
ld/testsuite/
* ld-elf/rel.c, ld-elf/relmain.c, ld-elf/relmain.out: New test.
* ld-elf/shared.exp: Build and run it.
* symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
is_needed by weak references. Clear version for symbols defined
in as-needed objects that are not needed.
gdb/python/python-internal.h (HAVE_SNPRINTF)
[_WIN32 && HAVE_DECL_SNPRINTF]: Define, to avoid compiler warnings
about redefinition of snprintf by pyerrors.h.
2013-03-12 Will Newton <will.newton@linaro.org>
* config/tc-arm.c (do_neon_ldr_str): Fix error check for PC register
in vstr in Thumb mode for pre-ARMv7 cores.
gas/testsuite/ChangeLog:
2013-03-12 Will Newton <will.newton@linaro.org>
* gas/arm/vstr-thumb-bad.d: Assemble with -mcpu=arm1156t2f-s.
static and public. Add report_err param. Return false for data refs.
(Target_powerpc::rela_dyn_section): New overloaded function.
(Target_powerpc::plt_, iplt_): Elucidate.
(Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
(Output_data_plt_powerpc::do_write): Don't write .iplt.
(Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
(Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
calls. Put ifunc dynamic relocs in irela_dyn_section. Only
push_branch and make_plt_entry for ifunc syms when
reloc_needs_plt_for_ifunc.
(Target_powerpc::Relocate::relocate): Don't use plt entry value
for ifunc unless reloc_needs_plt_for_ifunc.