external/binutils.git
9 years agoFix ChangeLog Date for previous push.
Kevin Buettner [Wed, 30 Sep 2015 12:58:56 +0000 (05:58 -0700)]
Fix ChangeLog Date for previous push.

9 years agoinfcmd.c: Don't attempt to record a NULL value after a finish command.
Kevin Buettner [Wed, 30 Sep 2015 12:54:15 +0000 (05:54 -0700)]
infcmd.c: Don't attempt to record a NULL value after a finish command.

Architectures which use RETURN_VALUE_STRUCT_CONVENTION will have a
NULL return value after executing a finish command.  See get_return_value()
in infcmd.c.

This patch avoids an eventual SIGSEV (caused by attempting to
derefrence a NULL pointer) by adding a suitable test to
finish_command_fsm_should_stop().

I encountered this problem while testing msp430:

(gdb) PASS: gdb.base/structs.exp: zed L<n> for finish; return 1 structs-tc
finish
Run till exit from #0  fun1 () at /ironwood1/sourceware-git/msp430-elf/../binutils-gdb/gdb/testsuite/gdb.base/structs.c:125
ERROR: Process no longer exists

gdb/ChangeLog:
     * infcmd.c (finish_command_fsm_should_stop): Don't attempt to
     record a NULL value.

9 years agobtrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
Markus Metzger [Mon, 24 Aug 2015 09:37:53 +0000 (11:37 +0200)]
btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails

If the atomic section in x86-tsx.S is aborted, the tsx.exp test will fail
even if the traced output is actually correct.

Consider abort scenarios in the test.

testsuite/
* gdb.btrace/tsx.exp: Consider multiple correct outputs in the record
instruction-history test.

9 years agoAlso check e_machine when merging sections
H.J. Lu [Wed, 30 Sep 2015 12:32:12 +0000 (05:32 -0700)]
Also check e_machine when merging sections

When we check consistency for merge ELF sections, we should not only
check EI_CLASS, but also compatible e_machine.

bfd/

PR ld/19013
* elflink.c (_bfd_elf_merge_sections): Only merge input bfds
that have the compatible ELF machine code with the output bfd.

ld/testsuite/

PR ld/19013
* ld-x86-64/pr19013-nacl.d: New file.
* ld-x86-64/pr19013-x32.d: Likewise.
* ld-x86-64/pr19013.d: Likewise.
* ld-x86-64/pr19013.s: Likewise.
* ld-x86-64/x86-64.exp: Run PR ld/19013 tests.

9 years agoRevise new e500 invalid opcode test
Alan Modra [Wed, 30 Sep 2015 08:56:12 +0000 (18:26 +0930)]
Revise new e500 invalid opcode test

.machine isn't available on all powerpc targets.

* gas/ppc/ppc.exp (e500-ill): Pass -me500.
* gas/ppc/e500-ill.s: Remove .machine.
* gas/ppc/e500-ill.l: Remove line numbers.

9 years agoConsistency check for merge sections
Alan Modra [Wed, 30 Sep 2015 02:15:32 +0000 (11:45 +0930)]
Consistency check for merge sections

We can't allow sections to be merged and sized by the ELF linker
backend and then later be output by the generic linker backend.  The
generic linker backend doesn't understand merge sections.

PR ld/19013
* elflink.c (_bfd_elf_merge_sections): Only merge input bfds that
will be handled by elf_link_input_bfd.  Rename abfd param to obfd.

9 years agoAdd fdpic and misc emulations to configure.tgt for sh*-*-linux*
Rich Felker [Wed, 30 Sep 2015 05:35:53 +0000 (14:35 +0900)]
Add fdpic and misc emulations to configure.tgt for sh*-*-linux*

9 years agoAdd fdpic and misc targets to config.bfd for sh*-*-linux*
Rich Felker [Wed, 30 Sep 2015 05:32:07 +0000 (14:32 +0900)]
Add fdpic and misc targets to config.bfd for sh*-*-linux*

9 years agomsp430: Fix bug regarding large memory model inferior function call arguments.
Kevin Buettner [Tue, 29 Sep 2015 23:31:48 +0000 (16:31 -0700)]
msp430: Fix bug regarding large memory model inferior function call arguments.

This change causes reference, struct, and union arguments to be treated
the same as pointer arguments when determining the size of the value to
place into a register.

The case for doing this for reference arguments is obvious.

The msp430 ABI specifies that struct and union arguments are passed by
reference.  This is why they're treated in the same manner as pointer
and reference arguments when computing the size of the value to place
into a register.

In my testing using this multilib...

msp430-sim/-msim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either

... I find that the the following failures, 125 in all, are fixed by this
patch.

FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns char
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns short
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns int
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns long
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns long double _Complex
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns char *
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns char
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns short
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns int
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns long
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns float
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns double
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns float _Complex
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns double _Complex
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns long double _Complex
FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns char *
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 7 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 8 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 9 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 10 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 11 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 12 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 13 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 14 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 15 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 16 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 17 structs-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-ti
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ti
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ti
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tl
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tl
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tl
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tll
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tll
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-td
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-td
FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tld
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tld
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 7 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 8 structs-ts-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ti-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ti-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-ti-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-ti-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-ti-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tl-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tl-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tl-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tl-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tl-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tll-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tf-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tf-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tf-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tf-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tf-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-td-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tld-tc
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tc-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tc-ts
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-ti
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-ti
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-ti
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tl
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-tl
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-tl
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tll
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-td
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tld
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-td-tf
FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tf-td
FAIL: gdb.cp/classes.exp: call class_param.Aref_a (g_A)
FAIL: gdb.cp/classes.exp: call class_param.Aref_x (g_A)
FAIL: gdb.cp/classes.exp: call class_param.Aref_a (g_B)
FAIL: gdb.cp/classes.exp: call class_param.Aref_x (g_B)
FAIL: gdb.cp/classes.exp: call class_param.Aval_a (g_A)
FAIL: gdb.cp/classes.exp: call class_param.Aval_x (g_A)
FAIL: gdb.cp/classes.exp: call class_param.Aval_a (g_B)
FAIL: gdb.cp/classes.exp: call class_param.Aval_x (g_B)
FAIL: gdb.cp/ref-params.exp: print value of f1 on Child in main
FAIL: gdb.cp/ref-params.exp: print value of f2 on Child in main
FAIL: gdb.cp/ref-params.exp: print value of f1 on (Child&) in main
FAIL: gdb.cp/ref-params.exp: print value of f2 on (Child&) in main
FAIL: gdb.cp/ref-params.exp: print value of f1 on Child& in f2
FAIL: gdb.cp/ref-params.exp: print f1(MQ)
FAIL: gdb.cp/ref-params.exp: print mf1(MQ)
FAIL: gdb.cp/ref-params.exp: print mf2(MQ)
FAIL: gdb.cp/ref-params.exp: print f1(MQR)
FAIL: gdb.cp/ref-params.exp: print mf1(MQR)
FAIL: gdb.cp/ref-params.exp: print mf2(MQR)
FAIL: gdb.python/py-xmethods.exp: Before: a1 + a2
FAIL: gdb.python/py-xmethods.exp: Before: a2 - a1
FAIL: gdb.python/py-xmethods.exp: Before: b1 - a1
FAIL: gdb.python/py-xmethods.exp: After: a2 - a1
FAIL: gdb.python/py-xmethods.exp: After: b1 - a1

gdb/ChangeLog:

* msp430-tdep.c (msp430_push_dummy_call): Treat reference, struct,
and union arguments the same as pointer arguments when determining
size of argument.

9 years agosim: ft32: correct simulation of MEMCPY and MEMSET
James Bowman [Tue, 29 Sep 2015 23:47:34 +0000 (23:47 +0000)]
sim: ft32: correct simulation of MEMCPY and MEMSET

The MEMCPY and MEMSET instructions should only examine the low 15 bits of
their length arguments.

9 years agosim: ft32: correctly simulate PM write port
James Bowman [Mon, 28 Sep 2015 23:49:36 +0000 (23:49 +0000)]
sim: ft32: correctly simulate PM write port

The FT32 simulator was not correctly simulating the behavior of the
program memory (PM) write port.  When it is locked, writes to the
data register do nothing.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDon't use the output section size to copy input section
H.J. Lu [Tue, 29 Sep 2015 16:35:47 +0000 (09:35 -0700)]
Don't use the output section size to copy input section

We can't use the output section size to copy input section since
--interleave will shrink the output section.  Instead, we change
bfd_convert_section_contents to return the updated input section
size.  When we do that, we don't need to adjust the output section
size to skip gap fills.

bfd/

PR binutils/19020
* bfd.c (bfd_convert_section_contents): Add ptr_size parameter.
* bfd-in2.h: Regenerated.

binutils/

PR binutils/19020
* objcopy.c (copy_object): Don't adjust the output section size
when copying from input sections.
(copy_section): Use input section size for the copy.  Get the
updated section size from bfd_convert_section_contents.

binutils/testsuite/

PR binutils/19020
* binutils-all/objcopy.exp: Run pr19020a and pr19020b.
* lib/utils-lib.exp (run_dump_test): Support binary input.
* binutils-all/pr19020.in: New file.
* binutils-all/pr19020a.d: Likewise.
* binutils-all/pr19020b.d: Likewise.

9 years agoUndo accidental commit
jamesbowman [Tue, 29 Sep 2015 16:37:38 +0000 (09:37 -0700)]
Undo accidental commit

9 years agoRebase patch #7
jamesbowman [Tue, 29 Sep 2015 16:31:09 +0000 (09:31 -0700)]
Rebase patch #7

9 years ago[FT32] Replace hard-coded instruction patterns with macros
jamesbowman [Tue, 29 Sep 2015 16:06:29 +0000 (09:06 -0700)]
[FT32] Replace hard-coded instruction patterns with macros

The stack unwinder can now use FT32_*() macros to interpet binary
instructions instead of local definitions.

2015-09-29  James Bowman  <james.bowman@ftdichip.com>

* ft32-tdep.c: #include "opcode/ft32.h".
Delete local macros IS_PUSH, PUSH_REG, IS_LINK, LINK_SIZE.
(ft32_analyze_prologue): Use FT32_* macros.

9 years agoAdjust the output section size to skip gap fills
H.J. Lu [Tue, 29 Sep 2015 13:33:03 +0000 (06:33 -0700)]
Adjust the output section size to skip gap fills

In objcopy, copy_object calls copy_section to copy contents of input
section to output section.  When --gap-fill= is used, objcopy extends
the size of output sectios to fill gaps between output sections with
gap fills.  In this case, we adjust the output section size to skip
gap files to avoid reading beypond the input section buffer before
calling copy_section and restore the output section size after input
sections have been copied.

binutils/

PR binutils/19005
* objcopy.c (copy_object): Adjust the output section size to
skip gap fills between sections when copying from input sections
to output sections.

ld/testsuite/

PR binutils/19005
* ld-elf/pr19005.d: New file.
* ld-elf/pr19005.s: Likewise.
* ld-elf/pr19005.t: Likewise.

9 years agoAdd support for extensions in the .machine pseudoop on S/390, e.g. ".machine zEC12...
Dominik Vogt [Tue, 29 Sep 2015 12:22:07 +0000 (13:22 +0100)]
Add support for extensions in the .machine pseudoop on S/390, e.g. ".machine zEC12+nohtm+vx"

gas * doc/c-s390.texi: Add documentation.
Add missing code markup.
* config/tc-s390.c (current_flags): New static variable.
(s390_parse_cpu): Parse cpu flags a la "+nohtm" etc.
(s390_setup_opcodes): Use cpu flags to determine the set of opcodes.
Fix indentation.
(md_parse_option): Call s390_parse_cpu with the new signature.
(s390_machine): Likewise.
Keep track of current_flags.
Simplify code a bit.
undefine MAX_HISTORY at end of function.
(s390_machinemode): undefine MAX_HISTORY at end of function.
Update an error message.

tests * gas/s390/s390.exp: Add new tests.
* gas/s390/machine-parsing-1.s: New test file.
* gas/s390/machine-parsing-1.l: Likewise.
* gas/s390/machine-parsing-2.s: Likewise.
* gas/s390/machine-parsing-2.l: Likewise.
* gas/s390/machine-parsing-3.s: Likewise.
* gas/s390/machine-parsing-3.l: Likewise.
* gas/s390/machine-parsing-4.s: Likewise.
* gas/s390/machine-parsing-4.l: Likewise.
* gas/s390/machine-parsing-5.s: Likewise.
* gas/s390/machine-parsing-5.l: Likewise.
* gas/s390/machine-parsing-6.s: Likewise.
* gas/s390/machine-parsing-6.l: Likewise.

opcode * s390.h (S390_INSTR_FLAG_HTM): New flag.
(S390_INSTR_FLAG_VX): New flag.
(S390_INSTR_FLAG_FACILITY_MASK): New flag mask.

opcodes * s390-mkopc.c (main): Parse htm and vx flag.
* s390-opc.txt: Mark instructions from the hardware transactional
memory and vector facilities with the "htm"/"vx" flag.

9 years agoPR/19014: Fix a spelling mistake in the linker documentation.
Nick Clifton [Tue, 29 Sep 2015 09:55:23 +0000 (10:55 +0100)]
PR/19014: Fix a spelling mistake in the linker documentation.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix last commit's ChangeLog
Simon Marchi [Mon, 28 Sep 2015 22:44:30 +0000 (18:44 -0400)]
Fix last commit's ChangeLog

I somehow managed to do the same mistake in my ChangeLog entry as what I
was trying to fix in the code...

9 years agocli-script.c: Fix read_next_line's comment
Simon Marchi [Mon, 28 Sep 2015 22:34:54 +0000 (18:34 -0400)]
cli-script.c: Fix read_next_line's comment

It seems obvious to me that stdout should in fact be stdin.

gdb/ChangeLog:

* cli/cli-script.c (read_next_line): Fix stdout -> stdout in
comment.

9 years agogdb.base/gcore.c (array_func): Add reference to static_array.
Doug Evans [Mon, 28 Sep 2015 20:27:28 +0000 (13:27 -0700)]
gdb.base/gcore.c (array_func): Add reference to static_array.

Otherwise clang will delete it: it's otherwise unused.

gdb/testsuite/ChangeLog:

* gdb.base/gcore.c (array_func): Add reference to static_array.

9 years agoMAINTAINERS: Add Iain Buclaw as D language maintainer.
Doug Evans [Mon, 28 Sep 2015 19:40:01 +0000 (12:40 -0700)]
MAINTAINERS: Add Iain Buclaw as D language maintainer.

gdb/ChangeLog:

* MAINTAINERS: Add Iain Buclaw as D language maintainer.

9 years agocommon/filestuff.c (make_cleanup_close): Update comment.
Doug Evans [Mon, 28 Sep 2015 18:31:54 +0000 (11:31 -0700)]
common/filestuff.c (make_cleanup_close): Update comment.

gdb/ChangeLog:

* common/filestuff.c (make_cleanup_close): Update comment.

9 years agoFT32: define macros for instruction recognition.
jamesbowman [Mon, 28 Sep 2015 18:22:06 +0000 (11:22 -0700)]
FT32: define macros for instruction recognition.

Other places (e.g. the gdb stack unwinder) can use these instead of
hard-coded patterns.

[include/Changelog]

2015-09-26  James Bowman  <james.bowman@ftdichip.com>

* opcode/ft32.h: Add instruction macros FT32_*()

9 years agoUpdare French translation for binutils and German translation for opcodes.
Nick Clifton [Mon, 28 Sep 2015 15:34:00 +0000 (16:34 +0100)]
Updare French translation for binutils and German translation for opcodes.

9 years agoPatches for illegal ppc 500 instructions
Tom Rix [Mon, 28 Sep 2015 02:39:32 +0000 (12:09 +0930)]
Patches for illegal ppc 500 instructions

This change marks a few opcodes as invalid for ppc e500 as well as adds
a test to verify the change.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix cast of xml_find_attribute's return value
Simon Marchi [Sat, 26 Sep 2015 21:15:05 +0000 (17:15 -0400)]
Fix cast of xml_find_attribute's return value

The cast auto-insert script inserted long unsigned int, but we should
use the typedef ULONGEST.  Fixes build failures on i386.

gdb/ChangeLog:

* btrace.c (parse_xml_btrace_block): Fix cast of
xml_find_attribute's return value.
* memory-map.c (memory_map_start_memory): Likewise.
* solib-svr4.c (library_list_start_library): Likewise.
* solib-target.c (library_list_start_segment): Likewise.
(library_list_start_section): Likewise.
* tracepoint.c (traceframe_info_start_memory): Likewise.

9 years ago[D] Fix regression in py-lookup-type.exp
Iain Buclaw [Sat, 26 Sep 2015 07:08:12 +0000 (09:08 +0200)]
[D] Fix regression in py-lookup-type.exp

In the console interpreter, primitive types are resolved in the expression
parser.  However that didn't take into consideration the script interface.

gdb/ChangeLog:

* d-namespace.c (d_lookup_symbol): New arg langdef.
All callers updated.  Support looking up symbol as a primitive type.
(lookup_module_scope): New arg langdef.  All callers updated.
Call d_lookup_symbol directly for simple bare symbols.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Sep 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix typo in syntax of record instruction-history begin, end.
Doug Evans [Fri, 25 Sep 2015 22:40:47 +0000 (15:40 -0700)]
Fix typo in syntax of record instruction-history begin, end.

gdb/doc/ChangeLog:

* gdb.texinfo (Process Record and Replay): Fix syntax of
"record instruction-history begin, end" and
"record function-call-history begin, end".

9 years agoThe FT32's disassembly of 10-bit literals has the incorrect mask.
jamesbowman [Fri, 25 Sep 2015 19:33:30 +0000 (12:33 -0700)]
The FT32's disassembly of 10-bit literals has the incorrect mask.

[opcodes]
* ft32-dis.c (print_insn_ft32): Fix incorrect data field mask.

9 years agoAdd some more casts (2/2)
Simon Marchi [Fri, 25 Sep 2015 18:08:07 +0000 (14:08 -0400)]
Add some more casts (2/2)

See previous patch's description.

gdb/ChangeLog:

* macrocmd.c (print_macro_callback): Add cast(s).
* macrotab.c (macro_bcache_str): Likewise.
(new_macro_definition): Likewise.
* main.c (captured_main): Likewise.
* maint.c (print_bfd_section_info): Likewise.
* mdebugread.c (mdebug_build_psymtabs): Likewise.
(basic_type): Likewise.
* memattr.c (mem_region_cmp): Likewise.
* memory-map.c (memory_map_start_memory): Likewise.
(memory_map_end_memory): Likewise.
(memory_map_start_property): Likewise.
(memory_map_end_property): Likewise.
(clear_result): Likewise.
* memrange.c (compare_mem_ranges): Likewise.
* mep-tdep.c (mep_analyze_frame_prologue): Likewise.
* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise.
* mi/mi-console.c (mi_console_file_delete): Likewise.
(mi_console_file_fputs): Likewise.
(mi_console_raw_packet): Likewise.
(mi_console_file_flush): Likewise.
(mi_console_set_raw): Likewise.
* mi/mi-interp.c (mi_interpreter_resume): Likewise.
(mi_new_thread): Likewise.
(mi_thread_exit): Likewise.
(mi_record_changed): Likewise.
(mi_inferior_added): Likewise.
(mi_inferior_appeared): Likewise.
(mi_inferior_exit): Likewise.
(mi_inferior_removed): Likewise.
(mi_interp_data): Likewise.
(mi_on_normal_stop): Likewise.
(mi_traceframe_changed): Likewise.
(mi_tsv_created): Likewise.
(mi_tsv_deleted): Likewise.
(mi_tsv_modified): Likewise.
(mi_breakpoint_created): Likewise.
(mi_breakpoint_deleted): Likewise.
(mi_breakpoint_modified): Likewise.
(mi_output_running_pid): Likewise.
(mi_inferior_count): Likewise.
(mi_solib_loaded): Likewise.
(mi_solib_unloaded): Likewise.
(mi_command_param_changed): Likewise.
(mi_memory_changed): Likewise.
(report_initial_inferior): Likewise.
(mi_ui_out): Likewise.
(mi_set_logging): Likewise.
* mi/mi-main.c (collect_cores): Likewise.
(print_one_inferior): Likewise.
(free_vector_of_ints): Likewise.
(free_splay_tree): Likewise.
(mi_execute_command): Likewise.
* mi/mi-out.c (mi_table_body): Likewise.
(mi_table_end): Likewise.
(mi_table_header): Likewise.
(mi_begin): Likewise.
(mi_end): Likewise.
(mi_field_int): Likewise.
(mi_field_string): Likewise.
(mi_field_fmt): Likewise.
(mi_flush): Likewise.
(mi_redirect): Likewise.
(field_separator): Likewise.
(mi_open): Likewise.
(mi_close): Likewise.
(mi_out_buffered): Likewise.
(mi_out_rewind): Likewise.
(mi_out_put): Likewise.
(mi_version): Likewise.
(mi_out_data_dtor): Likewise.
* mi/mi-parse.c (mi_parse_cleanup): Likewise.
* microblaze-tdep.c (microblaze_frame_cache): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
(lzma_close): Likewise.
(lzma_stat): Likewise.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* mips-sde-tdep.c (mips_sde_frame_cache): Likewise.
(mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise.
* mips-tdep.c (mips_insn16_frame_cache): Likewise.
(mips_micro_frame_cache): Likewise.
(mips_insn32_frame_cache): Likewise.
(mips_stub_frame_cache): Likewise.
(gdb_print_insn_mips): Likewise.
(value_of_mips_user_reg): Likewise.
(mips_gdbarch_init): Likewise.
* mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise.
(mipsnbsd_supply_gregset): Likewise.
* mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise.
(am33_collect_gregset_method): Likewise.
(am33_collect_fpregset_method): Likewise.
* mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise.
* moxie-tdep.c (moxie_frame_cache): Likewise.
* msp430-tdep.c (msp430_get_opcode_byte): Likewise.
(msp430_analyze_frame_prologue): Likewise.
* mt-tdep.c (mt_frame_unwind_cache): Likewise.
* nios2-linux-tdep.c (nios2_supply_gregset): Likewise.
(nios2_collect_gregset): Likewise.
* nios2-tdep.c (nios2_frame_unwind_cache): Likewise.
(nios2_stub_frame_cache): Likewise.
* objc-lang.c (find_methods): Likewise.
* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
(get_objfile_pspace_data): Likewise.
(get_objfile_bfd_data): Likewise.
(objfile_bfd_data_free): Likewise.
(add_to_objfile_sections): Likewise.
(do_free_objfile_cleanup): Likewise.
(resume_section_map_updates_cleanup): Likewise.
* opencl-lang.c (builtin_opencl_type): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
(osdata_start_item): Likewise.
(osdata_start_column): Likewise.
(osdata_end_column): Likewise.
(clear_parsing_data): Likewise.
(osdata_free_cleanup): Likewise.
* parse.c (type_stack_cleanup): Likewise.
(exp_uses_objfile_iter): Likewise.
* ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise.
(ppc_linux_collect_gregset): Likewise.
(ppu2spu_prev_arch): Likewise.
(ppu2spu_this_id): Likewise.
(ppu2spu_prev_register): Likewise.
(ppu2spu_unwind_register): Likewise.
(ppu2spu_sniffer): Likewise.
(ppu2spu_dealloc_cache): Likewise.
(ppc_linux_init_abi): Likewise.
* ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* progspace.c (restore_program_space): Likewise.
* psymtab.c (find_pc_sect_psymtab): Likewise.
(compare_psymbols): Likewise.
(psymbol_bcache_full): Likewise.
(allocate_psymtab): Likewise.
(discard_psymtabs_upto): Likewise.
* python/py-block.c (set_block): Likewise.
(del_objfile_blocks): Likewise.
* python/py-breakpoint.c (build_bp_list): Likewise.
* python/py-inferior.c (inferior_to_inferior_object): Likewise.
(build_inferior_list): Likewise.
(py_free_inferior): Likewise.
* python/py-objfile.c (py_free_objfile): Likewise.
(objfile_to_objfile_object): Likewise.
* python/py-prettyprint.c (py_restore_tstate): Likewise.
* python/py-progspace.c (py_free_pspace): Likewise.
(pspace_to_pspace_object): Likewise.
* python/py-symbol.c (set_symbol): Likewise.
(del_objfile_symbols): Likewise.
* python/py-symtab.c (set_sal): Likewise.
(set_symtab): Likewise.
(del_objfile_symtab): Likewise.
(del_objfile_sal): Likewise.
* python/py-type.c (save_objfile_types): Likewise.
(set_type): Likewise.
* python/py-unwind.c (pyuw_prev_register): Likewise.
(pyuw_on_new_gdbarch): Likewise.
* python/py-utils.c (py_decref): Likewise.
(py_xdecref): Likewise.
(gdb_py_generic_dict): Likewise.
* python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise.
(gdbpy_clone_xmethod_worker_data): Likewise.
(gdbpy_get_xmethod_arg_types): Likewise.
(gdbpy_get_xmethod_result_type): Likewise.
(gdbpy_invoke_xmethod): Likewise.
* python/python.c (gdbpy_apply_type_printers): Likewise.
(gdbpy_free_type_printers): Likewise.
* record-btrace.c (record_btrace_disable_callback): Likewise.
(bfcache_hash): Likewise.
(bfcache_eq): Likewise.
(btrace_get_frame_function): Likewise.
(record_btrace_frame_unwind_stop_reason): Likewise.
(record_btrace_frame_this_id): Likewise.
(record_btrace_frame_prev_register): Likewise.
(record_btrace_frame_dealloc_cache): Likewise.
* record-full.c (record_full_message_wrapper): Likewise.
(record_full_save_cleanups): Likewise.
* regcache.c (regcache_descr): Likewise.
(do_regcache_xfree): Likewise.
(do_regcache_invalidate): Likewise.
(do_cooked_read): Likewise.
(regcache_transfer_regset): Likewise.
* reggroups.c (reggroup_add): Likewise.
(reggroup_next): Likewise.
(reggroup_prev): Likewise.
* remote-fileio.c (do_remote_fileio_request): Likewise.
* remote-notif.c (remote_async_get_pending_events_handler): Likewise.
(do_notif_event_xfree): Likewise.
* remote.c (get_remote_arch_state): Likewise.
(remote_pspace_data_cleanup): Likewise.
(get_remote_exec_file): Likewise.
(set_pspace_remote_exec_file): Likewise.
(compare_pnums): Likewise.
(clear_threads_listing_context): Likewise.
(remote_newthread_step): Likewise.
(start_thread): Likewise.
(end_thread): Likewise.
(remove_child_of_pending_fork): Likewise.
(remove_stop_reply_for_inferior): Likewise.
(remove_stop_reply_of_remote_state): Likewise.
(remote_notif_remove_once_on_match): Likewise.
(stop_reply_match_ptid_and_ws): Likewise.
(kill_child_of_pending_fork): Likewise.
(register_remote_g_packet_guess): Likewise.
(remote_read_description_p): Likewise.
(remote_read_description): Likewise.
(free_actions_list_cleanup_wrapper): Likewise.
(remote_async_serial_handler): Likewise.
* rl78-tdep.c (rl78_get_opcode_byte): Likewise.
(rl78_analyze_frame_prologue): Likewise.
* rs6000-tdep.c (ppc_supply_gregset): Likewise.
(ppc_supply_fpregset): Likewise.
(ppc_supply_vsxregset): Likewise.
(ppc_supply_vrregset): Likewise.
(ppc_collect_gregset): Likewise.
(ppc_collect_fpregset): Likewise.
(ppc_collect_vsxregset): Likewise.
(ppc_collect_vrregset): Likewise.
(e500_move_ev_register): Likewise.
(do_regcache_raw_write): Likewise.
(rs6000_frame_cache): Likewise.
(rs6000_epilogue_frame_cache): Likewise.
(rs6000_gdbarch_init): Likewise.
* rx-tdep.c (rx_get_opcode_byte): Likewise.
(rx_analyze_frame_prologue): Likewise.
(rx_frame_type): Likewise.
(rx_frame_sniffer_common): Likewise.
* s390-linux-tdep.c (s390_check_for_saved): Likewise.
(s390_frame_unwind_cache): Likewise.
(s390_stub_frame_unwind_cache): Likewise.
(s390_sigtramp_frame_unwind_cache): Likewise.
* score-tdep.c (score_make_prologue_cache): Likewise.
* sentinel-frame.c (sentinel_frame_prev_register): Likewise.
(sentinel_frame_prev_arch): Likewise.
* ser-base.c (fd_event): Likewise.
(push_event): Likewise.
(ser_base_write): Likewise.
* ser-pipe.c (pipe_close): Likewise.
* serial.c (serial_write): Likewise.
* sh-tdep.c (sh_frame_cache): Likewise.
(sh_stub_this_id): Likewise.
* sh64-tdep.c (sh64_frame_cache): Likewise.
* solib-aix.c (get_solib_aix_inferior_data): Likewise.
(library_list_start_library): Likewise.
(library_list_start_list): Likewise.
(solib_aix_free_library_list): Likewise.
* solib-darwin.c (get_darwin_info): Likewise.
* solib-dsbt.c (get_dsbt_info): Likewise.
* solib-spu.c (append_ocl_sos): Likewise.
* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
(get_svr4_info): Likewise.
(library_list_start_library): Likewise.
(svr4_library_list_start_list): Likewise.
(hash_probe_and_action): Likewise.
(equal_probe_and_action): Likewise.
(svr4_update_solib_event_breakpoint): Likewise.
(set_solib_svr4_fetch_link_map_offsets): Likewise.
(svr4_fetch_link_map_offsets): Likewise.
(svr4_have_link_map_offsets): Likewise.
* solib-target.c (library_list_start_segment): Likewise.
(library_list_start_section): Likewise.
(library_list_start_library): Likewise.
(library_list_end_library): Likewise.
(library_list_start_list): Likewise.
(solib_target_free_library_list): Likewise.
* solib.c (solib_ops): Likewise.
(set_solib_ops): Likewise.
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
* sparc-tdep.c (sparc_frame_cache): Likewise.
(sparc32_frame_cache): Likewise.
(sparc32_supply_gregset): Likewise.
(sparc32_collect_gregset): Likewise.
(sparc32_supply_fpregset): Likewise.
(sparc32_collect_fpregset): Likewise.
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
* sparc64-tdep.c (sparc64_supply_gregset): Likewise.
(sparc64_collect_gregset): Likewise.
(sparc64_supply_fpregset): Likewise.
(sparc64_collect_fpregset): Likewise.
* sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise.
* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise.
* sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise.
(sparc64obsd_trapframe_cache): Likewise.
* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise.
* sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise.
* spu-multiarch.c (spu_gdbarch): Likewise.
* spu-tdep.c (spu_frame_unwind_cache): Likewise.
(spu2ppu_prev_arch): Likewise.
(spu2ppu_this_id): Likewise.
(spu2ppu_prev_register): Likewise.
(spu2ppu_dealloc_cache): Likewise.
(spu_dis_asm_print_address): Likewise.
(gdb_print_insn_spu): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (rs6000_builtin_type): Likewise.
* stack.c (do_print_variable_and_value): Likewise.
* stap-probe.c (get_stap_base_address_1): Likewise.
* symfile-debug.c (debug_qf_has_symbols): Likewise.
(debug_qf_find_last_source_symtab): Likewise.
(debug_qf_forget_cached_source_info): Likewise.
(debug_qf_map_symtabs_matching_filename): Likewise.
(debug_qf_lookup_symbol): Likewise.
(debug_qf_print_stats): Likewise.
(debug_qf_dump): Likewise.
(debug_qf_relocate): Likewise.
(debug_qf_expand_symtabs_for_function): Likewise.
(debug_qf_expand_all_symtabs): Likewise.
(debug_qf_expand_symtabs_with_fullname): Likewise.
(debug_qf_map_matching_symbols): Likewise.
(debug_qf_expand_symtabs_matching): Likewise.
(debug_qf_find_pc_sect_compunit_symtab): Likewise.
(debug_qf_map_symbol_filenames): Likewise.
(debug_sym_get_probes): Likewise.
(debug_sym_new_init): Likewise.
(debug_sym_init): Likewise.
(debug_sym_read): Likewise.
(debug_sym_read_psymbols): Likewise.
(debug_sym_finish): Likewise.
(debug_sym_offsets): Likewise.
(debug_sym_read_linetable): Likewise.
(debug_sym_relocate): Likewise.
(uninstall_symfile_debug_logging): Likewise.
* symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise.
* symfile.c (place_section): Likewise.
(add_section_size_callback): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(clear_memory_write_data): Likewise.
(allocate_symtab): Likewise.
* symmisc.c (maintenance_expand_file_matcher): Likewise.
* symtab.c (lookup_symtab_callback): Likewise.
(hash_demangled_name_entry): Likewise.
(eq_demangled_name_entry): Likewise.
(get_symbol_cache): Likewise.
(symbol_cache_cleanup): Likewise.
(set_symbol_cache_size): Likewise.
(symbol_cache_flush): Likewise.
(maintenance_print_symbol_cache): Likewise.
(maintenance_print_symbol_cache_statistics): Likewise.
(delete_filename_seen_cache): Likewise.
(output_partial_symbol_filename): Likewise.
(search_symbols_file_matches): Likewise.
(search_symbols_name_matches): Likewise.
(do_free_completion_list): Likewise.
(maybe_add_partial_symtab_filename): Likewise.
(get_main_info): Likewise.
(main_info_cleanup): Likewise.
* target-dcache.c (target_dcache_cleanup): Likewise.
(target_dcache_init_p): Likewise.
(target_dcache_invalidate): Likewise.
(target_dcache_get): Likewise.
(target_dcache_get_or_init): Likewise.
* target-descriptions.c (target_find_description): Likewise.
(tdesc_find_type): Likewise.
(tdesc_data_cleanup): Likewise.
(tdesc_find_arch_register): Likewise.
(tdesc_register_name): Likewise.
(tdesc_register_type): Likewise.
(tdesc_register_reggroup_p): Likewise.
(set_tdesc_pseudo_register_name): Likewise.
(set_tdesc_pseudo_register_type): Likewise.
(set_tdesc_pseudo_register_reggroup_p): Likewise.
(tdesc_use_registers): Likewise.
(free_target_description): Likewise.
* target-memory.c (compare_block_starting_address): Likewise.
(cleanup_request_data): Likewise.
(cleanup_write_requests_vector): Likewise.
* target.c (open_target): Likewise.
(cleanup_restore_target_terminal): Likewise.
(free_memory_read_result_vector): Likewise.
* thread.c (disable_thread_stack_temporaries): Likewise.
(finish_thread_state_cleanup): Likewise.
(do_restore_current_thread_cleanup): Likewise.
(restore_current_thread_cleanup_dtor): Likewise.
(set_thread_refcount): Likewise.
(tp_array_compar): Likewise.
(do_captured_thread_select): Likewise.
* tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise.
(tic6x_stub_this_id): Likewise.
* tilegx-tdep.c (tilegx_frame_cache): Likewise.
* top.c (do_restore_instream_cleanup): Likewise.
(gdb_readline_wrapper_cleanup): Likewise.
(kill_or_detach): Likewise.
(print_inferior_quit_action): Likewise.
* tracefile-tfile.c (match_blocktype): Likewise.
(build_traceframe_info): Likewise.
* tracefile.c (trace_file_writer_xfree): Likewise.
* tracepoint.c (memrange_cmp): Likewise.
(do_collect_symbol): Likewise.
(do_clear_collection_list): Likewise.
(do_restore_current_traceframe_cleanup): Likewise.
(restore_current_traceframe_cleanup_dtor): Likewise.
(free_current_marker): Likewise.
(traceframe_info_start_memory): Likewise.
(traceframe_info_start_tvar): Likewise.
(free_result): Likewise.
* tramp-frame.c (tramp_frame_cache): Likewise.
* tui/tui-file.c (tui_file_delete): Likewise.
(tui_fileopen): Likewise.
(tui_sfileopen): Likewise.
(tui_file_isatty): Likewise.
(tui_file_rewind): Likewise.
(tui_file_put): Likewise.
(tui_file_fputs): Likewise.
(tui_file_get_strbuf): Likewise.
(tui_file_adjust_strbuf): Likewise.
(tui_file_flush): Likewise.
* tui/tui-layout.c (make_command_window): Likewise.
(make_data_window): Likewise.
(show_source_disasm_command): Likewise.
(show_data): Likewise.
(make_source_or_disasm_window): Likewise.
(show_source_or_disasm_and_command): Likewise.
* tui/tui-out.c (tui_field_int): Likewise.
(tui_field_string): Likewise.
(tui_field_fmt): Likewise.
(tui_text): Likewise.
* typeprint.c (hash_typedef_field): Likewise.
(eq_typedef_field): Likewise.
(do_free_typedef_hash): Likewise.
(copy_typedef_hash_element): Likewise.
(do_free_global_table): Likewise.
(find_global_typedef): Likewise.
(find_typedef_in_hash): Likewise.
* ui-file.c (ui_file_write_for_put): Likewise.
(do_ui_file_xstrdup): Likewise.
(mem_file_delete): Likewise.
(mem_file_rewind): Likewise.
(mem_file_put): Likewise.
(mem_file_write): Likewise.
(stdio_file_delete): Likewise.
(stdio_file_flush): Likewise.
(stdio_file_read): Likewise.
(stdio_file_write): Likewise.
(stdio_file_write_async_safe): Likewise.
(stdio_file_fputs): Likewise.
(stdio_file_isatty): Likewise.
(stdio_file_fseek): Likewise.
(tee_file_delete): Likewise.
(tee_file_flush): Likewise.
(tee_file_write): Likewise.
(tee_file_fputs): Likewise.
(tee_file_isatty): Likewise.
* ui-out.c (do_cleanup_table_end): Likewise.
(do_cleanup_end): Likewise.
* user-regs.c (user_reg_add): Likewise.
(user_reg_map_name_to_regnum): Likewise.
(usernum_to_user_reg): Likewise.
(maintenance_print_user_registers): Likewise.
* utils.c (do_bfd_close_cleanup): Likewise.
(do_fclose_cleanup): Likewise.
(do_obstack_free): Likewise.
(do_ui_file_delete): Likewise.
(do_ui_out_redirect_pop): Likewise.
(do_free_section_addr_info): Likewise.
(restore_integer): Likewise.
(do_unpush_target): Likewise.
(do_htab_delete_cleanup): Likewise.
(do_restore_ui_file): Likewise.
(do_value_free): Likewise.
(do_free_so): Likewise.
(free_current_contents): Likewise.
(do_regfree_cleanup): Likewise.
(core_addr_hash): Likewise.
(core_addr_eq): Likewise.
(do_free_char_ptr_vec): Likewise.
* v850-tdep.c (v850_frame_cache): Likewise.
* varobj.c (do_free_variable_cleanup): Likewise.
* vax-tdep.c (vax_supply_gregset): Likewise.
(vax_frame_cache): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise.
* xml-support.c (gdb_xml_body_text): Likewise.
(gdb_xml_values_cleanup): Likewise.
(gdb_xml_start_element): Likewise.
(gdb_xml_start_element_wrapper): Likewise.
(gdb_xml_end_element): Likewise.
(gdb_xml_end_element_wrapper): Likewise.
(gdb_xml_cleanup): Likewise.
(gdb_xml_fetch_external_entity): Likewise.
(gdb_xml_parse_attr_enum): Likewise.
(xinclude_start_include): Likewise.
(xinclude_end_include): Likewise.
(xml_xinclude_default): Likewise.
(xml_xinclude_start_doctype): Likewise.
(xml_xinclude_end_doctype): Likewise.
(xml_xinclude_cleanup): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (free_syscalls_info): Likewise.
(syscall_start_syscall): Likewise.
* xml-tdesc.c (tdesc_end_arch): Likewise.
(tdesc_end_osabi): Likewise.
(tdesc_end_compatible): Likewise.
(tdesc_start_target): Likewise.
(tdesc_start_feature): Likewise.
(tdesc_start_reg): Likewise.
(tdesc_start_union): Likewise.
(tdesc_start_struct): Likewise.
(tdesc_start_flags): Likewise.
(tdesc_start_field): Likewise.
(tdesc_start_vector): Likewise.
(fetch_available_features_from_target): Likewise.
* xstormy16-tdep.c (xstormy16_frame_cache): Likewise.
* xtensa-tdep.c (xtensa_supply_gregset): Likewise.
(xtensa_frame_cache): Likewise.
(xtensa_frame_prev_register): Likewise.
(xtensa_extract_return_value): Likewise.

9 years agoAdd some more casts (1/2)
Simon Marchi [Fri, 25 Sep 2015 18:08:07 +0000 (14:08 -0400)]
Add some more casts (1/2)

Note: I needed to split this patch in two, otherwise it's too big for
the mailing list.

This patch adds explicit casts to situations where a void pointer is
assigned to a pointer to the "real" type.  Building in C++ mode requires
those assignments to use an explicit cast.  This includes, for example:

 - callback arguments (cleanups, comparison functions, ...)
 - data attached to some object (objfile, program space, etc) in the form
   of a void pointer
 - "user data" passed to some function

This patch comes from the commit "(mostly) auto-generated patch to insert
casts needed for C++", taken from Pedro's C++ branch.

Only files built on x86 with --enable-targets=all are modified, so the
native files for other arches will need to be dealt with separately.

I built-tested this with --enable-targets=all and reg-tested.  To my
surprise, a test case (selftest.exp) had to be adjusted.

Here's the ChangeLog entry.  Again, this was relatively quick to make
despite the length, thanks to David Malcom's script, although I don't
believe it's very useful information in that particular case...

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s).
(aarch64_make_stub_cache): Likewise.
(value_of_aarch64_user_reg): Likewise.
* ada-lang.c (ada_inferior_data_cleanup): Likewise.
(get_ada_inferior_data): Likewise.
(get_ada_pspace_data): Likewise.
(ada_pspace_data_cleanup): Likewise.
(ada_complete_symbol_matcher): Likewise.
(ada_exc_search_name_matches): Likewise.
* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
(get_ada_tasks_inferior_data): Likewise.
* addrmap.c (addrmap_mutable_foreach_worker): Likewise.
(splay_obstack_alloc): Likewise.
(splay_obstack_free): Likewise.
* alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise.
(alpha_linux_collect_gregset): Likewise.
(alpha_linux_supply_fpregset): Likewise.
(alpha_linux_collect_fpregset): Likewise.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_lds): Likewise.
(alpha_sts): Likewise.
(alpha_sigtramp_frame_unwind_cache): Likewise.
(alpha_heuristic_frame_unwind_cache): Likewise.
(alpha_supply_int_regs): Likewise.
(alpha_fill_int_regs): Likewise.
(alpha_supply_fp_regs): Likewise.
(alpha_fill_fp_regs): Likewise.
* alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise.
(alphanbsd_aout_supply_gregset): Likewise.
(alphanbsd_supply_gregset): Likewise.
* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
(amd64_x32_linux_init_abi): Likewise.
* amd64-nat.c (amd64_supply_native_gregset): Likewise.
(amd64_collect_native_gregset): Likewise.
* amd64-tdep.c (amd64_frame_cache): Likewise.
(amd64_sigtramp_frame_cache): Likewise.
(amd64_epilogue_frame_cache): Likewise.
(amd64_supply_fxsave): Likewise.
(amd64_supply_xsave): Likewise.
(amd64_collect_fxsave): Likewise.
(amd64_collect_xsave): Likewise.
* amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise.
* amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
(arm_linux_collect_gregset): Likewise.
(arm_linux_supply_nwfpe): Likewise.
(arm_linux_collect_nwfpe): Likewise.
(arm_linux_supply_vfp): Likewise.
(arm_linux_collect_vfp): Likewise.
* arm-tdep.c (arm_find_mapping_symbol): Likewise.
(arm_prologue_unwind_stop_reason): Likewise.
(arm_prologue_this_id): Likewise.
(arm_prologue_prev_register): Likewise.
(arm_exidx_data_free): Likewise.
(arm_find_exidx_entry): Likewise.
(arm_stub_this_id): Likewise.
(arm_m_exception_this_id): Likewise.
(arm_m_exception_prev_register): Likewise.
(arm_normal_frame_base): Likewise.
(gdb_print_insn_arm): Likewise.
(arm_objfile_data_free): Likewise.
(arm_record_special_symbol): Likewise.
(value_of_arm_user_reg): Likewise.
* armbsd-tdep.c (armbsd_supply_fpregset): Likewise.
(armbsd_supply_gregset): Likewise.
* auto-load.c (auto_load_pspace_data_cleanup): Likewise.
(get_auto_load_pspace_data): Likewise.
(hash_loaded_script_entry): Likewise.
(eq_loaded_script_entry): Likewise.
(clear_section_scripts): Likewise.
(collect_matching_scripts): Likewise.
* auxv.c (auxv_inferior_data_cleanup): Likewise.
(get_auxv_inferior_data): Likewise.
* avr-tdep.c (avr_frame_unwind_cache): Likewise.
* ax-general.c (do_free_agent_expr_cleanup): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
(target_bfd_xclose): Likewise.
(target_bfd_get_section_table): Likewise.
* bfin-tdep.c (bfin_frame_cache): Likewise.
* block.c (find_block_in_blockvector): Likewise.
(call_site_for_pc): Likewise.
(block_find_non_opaque_type_preferred): Likewise.
* break-catch-sig.c (signal_catchpoint_insert_location): Likewise.
(signal_catchpoint_remove_location): Likewise.
(signal_catchpoint_breakpoint_hit): Likewise.
(signal_catchpoint_print_one): Likewise.
(signal_catchpoint_print_mention): Likewise.
(signal_catchpoint_print_recreate): Likewise.
* break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise.
* breakpoint.c (do_cleanup_counted_command_line): Likewise.
(bp_location_compare_addrs): Likewise.
(get_first_locp_gte_addr): Likewise.
(check_tracepoint_command): Likewise.
(do_map_commands_command): Likewise.
(get_breakpoint_objfile_data): Likewise.
(free_breakpoint_probes): Likewise.
(do_captured_breakpoint_query): Likewise.
(compare_breakpoints): Likewise.
(bp_location_compare): Likewise.
(bpstat_remove_breakpoint_callback): Likewise.
(do_delete_breakpoint_cleanup): Likewise.
* bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise.
(bsd_uthread_set_collect_uthread): Likewise.
(bsd_uthread_activate): Likewise.
(bsd_uthread_fetch_registers): Likewise.
(bsd_uthread_store_registers): Likewise.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt_raw): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
(do_btrace_data_cleanup): Likewise.
* c-typeprint.c (find_typedef_for_canonicalize): Likewise.
* charset.c (cleanup_iconv): Likewise.
(do_cleanup_iterator): Likewise.
* cli-out.c (cli_uiout_dtor): Likewise.
(cli_table_begin): Likewise.
(cli_table_body): Likewise.
(cli_table_end): Likewise.
(cli_table_header): Likewise.
(cli_begin): Likewise.
(cli_end): Likewise.
(cli_field_int): Likewise.
(cli_field_skip): Likewise.
(cli_field_string): Likewise.
(cli_field_fmt): Likewise.
(cli_spaces): Likewise.
(cli_text): Likewise.
(cli_message): Likewise.
(cli_wrap_hint): Likewise.
(cli_flush): Likewise.
(cli_redirect): Likewise.
(out_field_fmt): Likewise.
(field_separator): Likewise.
(cli_out_set_stream): Likewise.
* cli/cli-cmds.c (compare_symtabs): Likewise.
* cli/cli-dump.c (call_dump_func): Likewise.
(restore_section_callback): Likewise.
* cli/cli-script.c (clear_hook_in_cleanup): Likewise.
(do_restore_user_call_depth): Likewise.
(do_free_command_lines_cleanup): Likewise.
* coff-pe-read.c (get_section_vmas): Likewise.
(pe_as16): Likewise.
(pe_as32): Likewise.
* coffread.c (coff_symfile_read): Likewise.
* common/agent.c (agent_look_up_symbols): Likewise.
* common/filestuff.c (do_close_cleanup): Likewise.
* common/format.c (free_format_pieces_cleanup): Likewise.
* common/vec.c (vec_o_reserve): Likewise.
* compile/compile-c-support.c (print_one_macro): Likewise.
* compile/compile-c-symbols.c (hash_symbol_error): Likewise.
(eq_symbol_error): Likewise.
(del_symbol_error): Likewise.
(error_symbol_once): Likewise.
(gcc_convert_symbol): Likewise.
(gcc_symbol_address): Likewise.
(hash_symname): Likewise.
(eq_symname): Likewise.
* compile/compile-c-types.c (hash_type_map_instance): Likewise.
(eq_type_map_instance): Likewise.
(insert_type): Likewise.
(convert_type): Likewise.
* compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise.
(setup_sections): Likewise.
(link_hash_table_free): Likewise.
(copy_sections): Likewise.
* compile/compile-object-run.c (do_module_cleanup): Likewise.
* compile/compile.c (compile_print_value): Likewise.
(do_rmdir): Likewise.
(cleanup_compile_instance): Likewise.
(cleanup_unlink_file): Likewise.
* completer.c (free_completion_tracker): Likewise.
* corelow.c (add_to_spuid_list): Likewise.
* cp-namespace.c (reset_directive_searched): Likewise.
* cp-support.c (reset_directive_searched): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise.
(cris_frame_unwind_cache): Likewise.
* d-lang.c (builtin_d_type): Likewise.
* d-namespace.c (reset_directive_searched): Likewise.
* dbxread.c (dbx_free_symfile_info): Likewise.
(do_free_bincl_list_cleanup): Likewise.
* disasm.c (hash_dis_line_entry): Likewise.
(eq_dis_line_entry): Likewise.
(dis_asm_print_address): Likewise.
(fprintf_disasm): Likewise.
(do_ui_file_delete): Likewise.
* doublest.c (convert_floatformat_to_doublest): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Likewise.
(dummy_frame_prev_register): Likewise.
(dummy_frame_this_id): Likewise.
* dwarf2-frame-tailcall.c (cache_hash): Likewise.
(cache_eq): Likewise.
(cache_find): Likewise.
(tailcall_frame_this_id): Likewise.
(dwarf2_tailcall_prev_register_first): Likewise.
(tailcall_frame_prev_register): Likewise.
(tailcall_frame_dealloc_cache): Likewise.
(tailcall_frame_prev_arch): Likewise.
* dwarf2-frame.c (dwarf2_frame_state_free): Likewise.
(dwarf2_frame_set_init_reg): Likewise.
(dwarf2_frame_init_reg): Likewise.
(dwarf2_frame_set_signal_frame_p): Likewise.
(dwarf2_frame_signal_frame_p): Likewise.
(dwarf2_frame_set_adjust_regnum): Likewise.
(dwarf2_frame_adjust_regnum): Likewise.
(clear_pointer_cleanup): Likewise.
(dwarf2_frame_cache): Likewise.
(find_cie): Likewise.
(dwarf2_frame_find_fde): Likewise.
* dwarf2expr.c (dwarf_expr_address_type): Likewise.
(free_dwarf_expr_context_cleanup): Likewise.
* dwarf2loc.c (locexpr_find_frame_base_location): Likewise.
(locexpr_get_frame_base): Likewise.
(loclist_find_frame_base_location): Likewise.
(loclist_get_frame_base): Likewise.
(dwarf_expr_dwarf_call): Likewise.
(dwarf_expr_get_base_type): Likewise.
(dwarf_expr_push_dwarf_reg_entry_value): Likewise.
(dwarf_expr_get_obj_addr): Likewise.
(entry_data_value_coerce_ref): Likewise.
(entry_data_value_copy_closure): Likewise.
(entry_data_value_free_closure): Likewise.
(get_frame_address_in_block_wrapper): Likewise.
(dwarf2_evaluate_property): Likewise.
(dwarf2_compile_property_to_c): Likewise.
(needs_frame_read_addr_from_reg): Likewise.
(needs_frame_get_reg_value): Likewise.
(needs_frame_frame_base): Likewise.
(needs_frame_frame_cfa): Likewise.
(needs_frame_tls_address): Likewise.
(needs_frame_dwarf_call): Likewise.
(needs_dwarf_reg_entry_value): Likewise.
(get_ax_pc): Likewise.
(locexpr_read_variable): Likewise.
(locexpr_read_variable_at_entry): Likewise.
(locexpr_read_needs_frame): Likewise.
(locexpr_describe_location): Likewise.
(locexpr_tracepoint_var_ref): Likewise.
(locexpr_generate_c_location): Likewise.
(loclist_read_variable): Likewise.
(loclist_read_variable_at_entry): Likewise.
(loclist_describe_location): Likewise.
(loclist_tracepoint_var_ref): Likewise.
(loclist_generate_c_location): Likewise.
* dwarf2read.c (line_header_hash_voidp): Likewise.
(line_header_eq_voidp): Likewise.
(dwarf2_has_info): Likewise.
(dwarf2_get_section_info): Likewise.
(locate_dwz_sections): Likewise.
(hash_file_name_entry): Likewise.
(eq_file_name_entry): Likewise.
(delete_file_name_entry): Likewise.
(dw2_setup): Likewise.
(dw2_get_file_names_reader): Likewise.
(dw2_find_pc_sect_compunit_symtab): Likewise.
(hash_signatured_type): Likewise.
(eq_signatured_type): Likewise.
(add_signatured_type_cu_to_table): Likewise.
(create_debug_types_hash_table): Likewise.
(lookup_dwo_signatured_type): Likewise.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(hash_type_unit_group): Likewise.
(eq_type_unit_group): Likewise.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(sort_tu_by_abbrev_offset): Likewise.
(process_skeletonless_type_unit): Likewise.
(psymtabs_addrmap_cleanup): Likewise.
(dwarf2_read_symtab): Likewise.
(psymtab_to_symtab_1): Likewise.
(die_hash): Likewise.
(die_eq): Likewise.
(load_full_comp_unit_reader): Likewise.
(reset_die_in_process): Likewise.
(free_cu_line_header): Likewise.
(handle_DW_AT_stmt_list): Likewise.
(hash_dwo_file): Likewise.
(eq_dwo_file): Likewise.
(hash_dwo_unit): Likewise.
(eq_dwo_unit): Likewise.
(create_dwo_cu_reader): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(dwarf2_locate_dwo_sections): Likewise.
(dwarf2_locate_common_dwp_sections): Likewise.
(dwarf2_locate_v2_dwp_sections): Likewise.
(hash_dwp_loaded_cutus): Likewise.
(eq_dwp_loaded_cutus): Likewise.
(lookup_dwo_cutu): Likewise.
(abbrev_table_free_cleanup): Likewise.
(dwarf2_free_abbrev_table): Likewise.
(find_partial_die_in_comp_unit): Likewise.
(free_line_header_voidp): Likewise.
(follow_die_offset): Likewise.
(follow_die_sig_1): Likewise.
(free_heap_comp_unit): Likewise.
(free_stack_comp_unit): Likewise.
(dwarf2_free_objfile): Likewise.
(per_cu_offset_and_type_hash): Likewise.
(per_cu_offset_and_type_eq): Likewise.
(get_die_type_at_offset): Likewise.
(partial_die_hash): Likewise.
(partial_die_eq): Likewise.
(dwarf2_per_objfile_free): Likewise.
(hash_strtab_entry): Likewise.
(eq_strtab_entry): Likewise.
(add_string): Likewise.
(hash_symtab_entry): Likewise.
(eq_symtab_entry): Likewise.
(delete_symtab_entry): Likewise.
(cleanup_mapped_symtab): Likewise.
(add_indices_to_cpool): Likewise.
(hash_psymtab_cu_index): Likewise.
(eq_psymtab_cu_index): Likewise.
(add_address_entry_worker): Likewise.
(unlink_if_set): Likewise.
(write_one_signatured_type): Likewise.
(save_gdb_index_command): Likewise.
* elfread.c (elf_symtab_read): Likewise.
(elf_gnu_ifunc_cache_hash): Likewise.
(elf_gnu_ifunc_cache_eq): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_get_probes): Likewise.
(probe_key_free): Likewise.
* f-lang.c (builtin_f_type): Likewise.
* frame-base.c (frame_base_append_sniffer): Likewise.
(frame_base_set_default): Likewise.
(frame_base_find_by_frame): Likewise.
* frame-unwind.c (frame_unwind_prepend_unwinder): Likewise.
(frame_unwind_append_unwinder): Likewise.
(frame_unwind_find_by_frame): Likewise.
* frame.c (frame_addr_hash): Likewise.
(frame_addr_hash_eq): Likewise.
(frame_stash_find): Likewise.
(do_frame_register_read): Likewise.
(unwind_to_current_frame): Likewise.
(frame_cleanup_after_sniffer): Likewise.
* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
* frv-tdep.c (frv_frame_unwind_cache): Likewise.
* ft32-tdep.c (ft32_frame_cache): Likewise.
* gcore.c (do_bfd_delete_cleanup): Likewise.
(gcore_create_callback): Likewise.
* gdb_bfd.c (hash_bfd): Likewise.
(eq_bfd): Likewise.
(gdb_bfd_open): Likewise.
(free_one_bfd_section): Likewise.
(gdb_bfd_ref): Likewise.
(gdb_bfd_unref): Likewise.
(get_section_descriptor): Likewise.
(gdb_bfd_map_section): Likewise.
(gdb_bfd_crc): Likewise.
(gdb_bfd_mark_parent): Likewise.
(gdb_bfd_record_inclusion): Likewise.
(gdb_bfd_requires_relocations): Likewise.
(print_one_bfd): Likewise.
* gdbtypes.c (type_pair_hash): Likewise.
(type_pair_eq): Likewise.
(builtin_type): Likewise.
(objfile_type): Likewise.
* gnu-v3-abi.c (vtable_ptrdiff_type): Likewise.
(vtable_address_point_offset): Likewise.
(gnuv3_get_vtable): Likewise.
(hash_value_and_voffset): Likewise.
(eq_value_and_voffset): Likewise.
(compare_value_and_voffset): Likewise.
(compute_vtable_size): Likewise.
(gnuv3_get_typeid_type): Likewise.
* go-lang.c (builtin_go_type): Likewise.
* guile/scm-block.c (bkscm_hash_block_smob): Likewise.
(bkscm_eq_block_smob): Likewise.
(bkscm_objfile_block_map): Likewise.
(bkscm_del_objfile_blocks): Likewise.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise.
* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise.
(gdbscm_disasm_print_address): Likewise.
* guile/scm-frame.c (frscm_hash_frame_smob): Likewise.
(frscm_eq_frame_smob): Likewise.
(frscm_inferior_frame_map): Likewise.
(frscm_del_inferior_frames): Likewise.
* guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise.
* guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise.
(ofscm_objfile_smob_from_objfile): Likewise.
* guile/scm-ports.c (ioscm_write): Likewise.
(ioscm_file_port_delete): Likewise.
(ioscm_file_port_rewind): Likewise.
(ioscm_file_port_put): Likewise.
(ioscm_file_port_write): Likewise.
* guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise.
(psscm_pspace_smob_from_pspace): Likewise.
* guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise.
(scscm_recording_unwind_handler): Likewise.
(gdbscm_with_catch): Likewise.
(scscm_call_0_body): Likewise.
(scscm_call_1_body): Likewise.
(scscm_call_2_body): Likewise.
(scscm_call_3_body): Likewise.
(scscm_call_4_body): Likewise.
(scscm_apply_1_body): Likewise.
(scscm_eval_scheme_string): Likewise.
(gdbscm_safe_eval_string): Likewise.
(scscm_source_scheme_script): Likewise.
(gdbscm_safe_source_script): Likewise.
* guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise.
(gdbscm_call_scm_from_stringn): Likewise.
* guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise.
(syscm_eq_symbol_smob): Likewise.
(syscm_get_symbol_map): Likewise.
(syscm_del_objfile_symbols): Likewise.
* guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise.
(stscm_eq_symtab_smob): Likewise.
(stscm_objfile_symtab_map): Likewise.
(stscm_del_objfile_symtabs): Likewise.
* guile/scm-type.c (tyscm_hash_type_smob): Likewise.
(tyscm_eq_type_smob): Likewise.
(tyscm_type_map): Likewise.
(tyscm_copy_type_recursive): Likewise.
(save_objfile_types): Likewise.
* guile/scm-utils.c (extract_arg): Likewise.
* h8300-tdep.c (h8300_frame_cache): Likewise.
* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise.
* hppa-tdep.c (compare_unwind_entries): Likewise.
(find_unwind_entry): Likewise.
(hppa_frame_cache): Likewise.
(hppa_stub_frame_unwind_cache): Likewise.
* hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise.
* hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise.
(hppaobsd_supply_fpregset): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
* i386-tdep.c (i386_frame_cache): Likewise.
(i386_epilogue_frame_cache): Likewise.
(i386_sigtramp_frame_cache): Likewise.
(i386_supply_gregset): Likewise.
(i386_collect_gregset): Likewise.
(i386_gdbarch_init): Likewise.
* i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise.
(i386obsd_trapframe_cache): Likewise.
* i387-tdep.c (i387_supply_fsave): Likewise.
(i387_collect_fsave): Likewise.
(i387_supply_fxsave): Likewise.
(i387_collect_fxsave): Likewise.
(i387_supply_xsave): Likewise.
(i387_collect_xsave): Likewise.
* ia64-tdep.c (ia64_frame_cache): Likewise.
(ia64_sigtramp_frame_cache): Likewise.
* infcmd.c (attach_command_continuation): Likewise.
(attach_command_continuation_free_args): Likewise.
* inferior.c (restore_inferior): Likewise.
(delete_thread_of_inferior): Likewise.
* inflow.c (inflow_inferior_data_cleanup): Likewise.
(get_inflow_inferior_data): Likewise.
(inflow_inferior_exit): Likewise.
* infrun.c (displaced_step_clear_cleanup): Likewise.
(restore_current_uiout_cleanup): Likewise.
(release_stop_context_cleanup): Likewise.
(do_restore_infcall_suspend_state_cleanup): Likewise.
(do_restore_infcall_control_state_cleanup): Likewise.
(restore_inferior_ptid): Likewise.
* inline-frame.c (block_starting_point_at): Likewise.
* iq2000-tdep.c (iq2000_frame_cache): Likewise.
* jit.c (get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_close_impl): Likewise.
(jit_find_objf_with_entry_addr): Likewise.
(jit_breakpoint_deleted): Likewise.
(jit_unwind_reg_set_impl): Likewise.
(jit_unwind_reg_get_impl): Likewise.
(jit_dealloc_cache): Likewise.
(jit_frame_sniffer): Likewise.
(jit_frame_prev_register): Likewise.
(jit_prepend_unwinder): Likewise.
(jit_inferior_exit_hook): Likewise.
(free_objfile_data): Likewise.
* jv-lang.c (jv_per_objfile_free): Likewise.
(get_dynamics_objfile): Likewise.
(get_java_class_symtab): Likewise.
(builtin_java_type): Likewise.
* language.c (language_string_char_type): Likewise.
(language_bool_type): Likewise.
(language_lookup_primitive_type): Likewise.
(language_lookup_primitive_type_as_symbol): Likewise.
* linespec.c (hash_address_entry): Likewise.
(eq_address_entry): Likewise.
(iterate_inline_only): Likewise.
(iterate_name_matcher): Likewise.
(decode_line_2_compare_items): Likewise.
(collect_one_symbol): Likewise.
(compare_symbols): Likewise.
(compare_msymbols): Likewise.
(add_symtabs_to_list): Likewise.
(collect_symbols): Likewise.
(compare_msyms): Likewise.
(add_minsym): Likewise.
(cleanup_linespec_result): Likewise.
* linux-fork.c (inferior_call_waitpid_cleanup): Likewise.
* linux-nat.c (delete_lwp_cleanup): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* linux-tdep.c (get_linux_gdbarch_data): Likewise.
(invalidate_linux_cache_inf): Likewise.
(get_linux_inferior_data): Likewise.
(linux_find_memory_regions_thunk): Likewise.
(linux_make_mappings_callback): Likewise.
(linux_corefile_thread_callback): Likewise.
(find_mapping_size): Likewise.
* linux-thread-db.c (find_new_threads_callback): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m2-lang.c (builtin_m2_type): Likewise.
* m32c-tdep.c (m32c_analyze_frame_prologue): Likewise.
* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise.
(m32r_linux_supply_gregset): Likewise.
(m32r_linux_collect_gregset): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* m68k-tdep.c (m68k_frame_cache): Likewise.
* m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
(m68kbsd_supply_gregset): Likewise.
* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
* m88k-tdep.c (m88k_frame_cache): Likewise.
(m88k_supply_gregset): Likewise.

gdb/gdbserver/ChangeLog:

* dll.c (match_dll): Add cast(s).
(unloaded_dll): Likewise.
* linux-low.c (second_thread_of_pid_p): Likewise.
(delete_lwp_callback): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(linux_set_resume_request): Likewise.
* server.c (accumulate_file_name_length): Likewise.
(emit_dll_description): Likewise.
(handle_qxfer_threads_worker): Likewise.
(visit_actioned_threads): Likewise.
* thread-db.c (any_thread_of): Likewise.
* tracepoint.c (same_process_p): Likewise.
(match_blocktype): Likewise.
(build_traceframe_info_xml): Likewise.

gdb/testsuite/ChangeLog:

* gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected
source line.

9 years agoAdd casts to memory allocation related calls
Simon Marchi [Fri, 25 Sep 2015 18:08:06 +0000 (14:08 -0400)]
Add casts to memory allocation related calls

Most allocation functions (if not all) return a void* pointing to the
allocated memory.  In C++, we need to add an explicit cast when
assigning the result to a pointer to another type (which is the case
more often than not).

The content of this patch is taken from Pedro's branch, from commit
"(mostly) auto-generated patch to insert casts needed for C++".  I
validated that the changes make sense and manually reflowed the code to
make it respect the coding style.  I also found multiple places where I
could use XNEW/XNEWVEC/XRESIZEVEC/etc.

Thanks a lot to whoever did that automated script to insert casts, doing
it completely by hand would have taken a ridiculous amount of time.

Only files built on x86 with --enable-targets=all are modified.  This
means that all other -nat.c files are untouched and will have to be
dealt with later by using appropiate compilers.  Or maybe we can try to
build them with a regular g++ just to know where to add casts, I don't
know.

I built-tested this with --enable-targets=all and reg-tested.

Here's the changelog entry, which was not too bad to make despite the
size, thanks to David Malcom's script.  I fixed some bits by hand, but
there might be some wrong parts left (hopefully not).

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
to allocation result assignment.
* ada-exp.y (write_object_renaming): Likewise.
(write_ambiguous_var): Likewise.
(ada_nget_field_index): Likewise.
(write_var_or_type): Likewise.
* ada-lang.c (ada_decode_symbol): Likewise.
(ada_value_assign): Likewise.
(value_pointer): Likewise.
(cache_symbol): Likewise.
(add_nonlocal_symbols): Likewise.
(ada_name_for_lookup): Likewise.
(symbol_completion_add): Likewise.
(ada_to_fixed_type_1): Likewise.
(ada_get_next_arg): Likewise.
(defns_collected): Likewise.
* ada-lex.l (processId): Likewise.
(processString): Likewise.
* ada-tasks.c (read_known_tasks_array): Likewise.
(read_known_tasks_list): Likewise.
* ada-typeprint.c (decoded_type_name): Likewise.
* addrmap.c (addrmap_mutable_create_fixed): Likewise.
* amd64-tdep.c (amd64_push_arguments): Likewise.
(amd64_displaced_step_copy_insn): Likewise.
(amd64_classify_insn_at): Likewise.
(amd64_relocate_instruction): Likewise.
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
(initialize_current_architecture): Likewise.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
* arm-tdep.c (arm_exidx_new_objfile): Likewise.
(arm_push_dummy_call): Likewise.
(extend_buffer_earlier): Likewise.
(arm_adjust_breakpoint_address): Likewise.
(arm_skip_stub): Likewise.
* auto-load.c (filename_is_in_pattern): Likewise.
(maybe_add_script_file): Likewise.
(maybe_add_script_text): Likewise.
(auto_load_objfile_script_1): Likewise.
* auxv.c (ld_so_xfer_auxv): Likewise.
* ax-general.c (new_agent_expr): Likewise.
(grow_expr): Likewise.
(ax_reg_mask): Likewise.
* bcache.c (bcache_full): Likewise.
* breakpoint.c (program_breakpoint_here_p): Likewise.
* btrace.c (parse_xml_raw): Likewise.
* build-id.c (build_id_to_debug_bfd): Likewise.
* buildsym.c (end_symtab_with_blockvector): Likewise.
* c-exp.y (string_exp): Likewise.
(qualified_name): Likewise.
(write_destructor_name): Likewise.
(operator_stoken): Likewise.
(parse_number): Likewise.
(scan_macro_expansion): Likewise.
(yylex): Likewise.
(c_print_token): Likewise.
* c-lang.c (c_get_string): Likewise.
(emit_numeric_character): Likewise.
* charset.c (wchar_iterate): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
(make_command): Likewise.
* cli/cli-dump.c (restore_section_callback): Likewise.
(restore_binary_file): Likewise.
* cli/cli-interp.c (cli_interpreter_exec): Likewise.
* cli/cli-script.c (execute_control_command): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
(read_pe_exported_syms): Likewise.
* coffread.c (coff_read_struct_type): Likewise.
(coff_read_enum_type): Likewise.
* common/btrace-common.c (btrace_data_append): Likewise.
* common/buffer.c (buffer_grow): Likewise.
* common/filestuff.c (gdb_fopen_cloexec): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
* common/xml-utils.c (xml_escape_text): Likewise.
* compile/compile-object-load.c (copy_sections): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* completer.c (filename_completer): Likewise.
* corefile.c (read_memory_typed_address): Likewise.
(write_memory_unsigned_integer): Likewise.
(write_memory_signed_integer): Likewise.
(complete_set_gnutarget): Likewise.
* corelow.c (get_core_register_section): Likewise.
* cp-name-parser.y (d_grab): Likewise.
(allocate_info): Likewise.
(cp_new_demangle_parse_info): Likewise.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
(cp_lookup_symbol_in_namespace): Likewise.
(lookup_namespace_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(cp_lookup_nested_symbol): Likewise.
(cp_lookup_transparent_type_loop): Likewise.
* cp-support.c (copy_string_to_obstack): Likewise.
(make_symbol_overload_list): Likewise.
(make_symbol_overload_list_namespace): Likewise.
(make_symbol_overload_list_adl_namespace): Likewise.
(first_component_command): Likewise.
* cp-valprint.c (cp_print_value): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* d-exp.y (StringExp): Likewise.
* d-namespace.c (d_lookup_symbol_in_module): Likewise.
(lookup_module_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(d_lookup_nested_symbol): Likewise.
* dbxread.c (find_stab_function_addr): Likewise.
(read_dbx_symtab): Likewise.
(dbx_end_psymtab): Likewise.
(cp_set_block_scope): Likewise.
* dcache.c (dcache_alloc): Likewise.
* demangle.c (_initialize_demangler): Likewise.
* dicos-tdep.c (dicos_load_module_p): Likewise.
* dictionary.c (dict_create_hashed_expandable): Likewise.
(dict_create_linear_expandable): Likewise.
(expand_hashtable): Likewise.
(add_symbol_linear_expandable): Likewise.
* dwarf2-frame.c (add_cie): Likewise.
(add_fde): Likewise.
(dwarf2_build_frame_info): Likewise.
* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
(dwarf_expr_fetch_address): Likewise.
(add_piece): Likewise.
(execute_stack_op): Likewise.
* dwarf2loc.c (chain_candidate): Likewise.
(dwarf_entry_parameter_to_value): Likewise.
(read_pieced_value): Likewise.
(write_pieced_value): Likewise.
* dwarf2read.c (dwarf2_read_section): Likewise.
(add_type_unit): Likewise.
(read_comp_units_from_section): Likewise.
(fixup_go_packaging): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_attach_fields_to_type): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(read_common_block): Likewise.
(abbrev_table_read_table): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(add_file_name): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(build_error_marker_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(typename_concat): Likewise.
(dwarf2_canonicalize_name): Likewise.
(dwarf2_name): Likewise.
(write_constant_as_bytes): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(copy_string): Likewise.
(parse_macro_definition): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_rel_plt_read): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_gnu_ifunc_resolve_by_got): Likewise.
(elf_read_minimal_symbols): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
* event-top.c (top_level_prompt): Likewise.
(command_line_handler): Likewise.
* exec.c (resize_section_table): Likewise.
* expprint.c (print_subexp_standard): Likewise.
* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
* findcmd.c (parse_find_args): Likewise.
* findvar.c (address_from_register): Likewise.
* frame.c (get_prev_frame_always): Likewise.
* gdb_bfd.c (gdb_bfd_ref): Likewise.
(get_section_descriptor): Likewise.
* gdb_obstack.c (obconcat): Likewise.
(obstack_strdup): Likewise.
* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
(create_set_type): Likewise.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(add_dyn_prop): Likewise.
(copy_dynamic_prop_list): Likewise.
(arch_flags_type): Likewise.
(append_composite_type_field_raw): Likewise.
* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
* go-exp.y (string_exp): Likewise.
* go-lang.c (go_demangle): Likewise.
* guile/guile.c (compute_scheme_string): Likewise.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
(gdbscm_canonicalize_command_name): Likewise.
* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
(ioscm_init_memory_port): Likewise.
(ioscm_reinit_memory_port): Likewise.
* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
(gdbscm_gc_dup_argv): Likewise.
* h8300-tdep.c (h8300_push_dummy_call): Likewise.
* hppa-tdep.c (internalize_unwinds): Likewise.
(read_unwind_info): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
(windows_core_xfer_shared_libraries): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
(i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
* inf-child.c (inf_child_fileio_readlink): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
(inf_ptrace_store_register): Likewise.
* infrun.c (follow_exec): Likewise.
(displaced_step_prepare_throw): Likewise.
(save_stop_context): Likewise.
(save_infcall_suspend_state): Likewise.
* jit.c (jit_read_descriptor): Likewise.
(jit_read_code_entry): Likewise.
(jit_symtab_line_mapping_add_impl): Likewise.
(finalize_symtab): Likewise.
(jit_unwind_reg_get_impl): Likewise.
* jv-exp.y (QualifiedName): Likewise.
* jv-lang.c (get_java_utf8_name): Likewise.
(type_from_class): Likewise.
(java_demangle_type_signature): Likewise.
(java_class_name_from_physname): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* language.c (add_language): Likewise.
* linespec.c (add_sal_to_sals_basic): Likewise.
(add_sal_to_sals): Likewise.
(decode_objc): Likewise.
(find_linespec_symbols): Likewise.
* linux-fork.c (fork_save_infrun_state): Likewise.
* linux-nat.c (linux_nat_detach): Likewise.
(linux_nat_fileio_readlink): Likewise.
* linux-record.c (record_linux_sockaddr): Likewise.
(record_linux_msghdr): Likewise.
(Do): Likewise.
* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
(linux_collect_regset_section_cb): Likewise.
(linux_get_siginfo_data): Likewise.
* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
(try_thread_db_load_from_dir): Likewise.
(thread_db_load_search): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
(m32c_m16c_pointer_to_address): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* machoread.c (macho_check_dsym): Likewise.
* macroexp.c (resize_buffer): Likewise.
(gather_arguments): Likewise.
(maybe_expand): Likewise.
* macrotab.c (new_macro_key): Likewise.
(new_source_file): Likewise.
(new_macro_definition): Likewise.
* mdebugread.c (parse_symbol): Likewise.
(parse_type): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
* mem-break.c (default_memory_insert_breakpoint): Likewise.
* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_data_write_memory_bytes): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
(mi_parse): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
* mips-tdep.c (mips_read_fp_register_single): Likewise.
(mips_print_fp_register): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
* mt-tdep.c (mt_register_name): Likewise.
(mt_registers_info): Likewise.
(mt_push_dummy_call): Likewise.
* namespace.c (add_using_directive): Likewise.
* nat/linux-btrace.c (perf_event_read): Likewise.
(linux_enable_bts): Likewise.
* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Likewise.
(nto_parse_redirection): Likewise.
* objc-lang.c (objc_demangle): Likewise.
(find_methods): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(set_objfile_main_name): Likewise.
(allocate_objfile): Likewise.
(objfile_relocate): Likewise.
(update_section_map): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* p-exp.y (exp): Likewise.
(yylex): Likewise.
* p-valprint.c (pascal_object_print_value): Likewise.
* parse.c (initialize_expout): Likewise.
(mark_completion_tag): Likewise.
(copy_name): Likewise.
(parse_float): Likewise.
(type_stack_reserve): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
(ppu2spu_prev_register): Likewise.
* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
* printcmd.c (printf_wide_c_string): Likewise.
(printf_pointer): Likewise.
* probe.c (parse_probes): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
(cmdpy_init): Likewise.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
* python/py-symtab.c (set_sal): Likewise.
* python/py-unwind.c (pyuw_sniffer): Likewise.
* python/python.c (python_interactive_command): Likewise.
(compute_python_string): Likewise.
* ravenscar-thread.c (get_running_thread_id): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_core_open_1): Likewise.
* regcache.c (regcache_raw_read_signed): Likewise.
(regcache_raw_read_unsigned): Likewise.
(regcache_cooked_read_signed): Likewise.
(regcache_cooked_read_unsigned): Likewise.
* remote-fileio.c (remote_fileio_func_open): Likewise.
(remote_fileio_func_rename): Likewise.
(remote_fileio_func_unlink): Likewise.
(remote_fileio_func_stat): Likewise.
(remote_fileio_func_system): Likewise.
* remote-mips.c (mips_xfer_memory): Likewise.
(mips_load_srec): Likewise.
(pmon_end_download): Likewise.
* remote.c (new_remote_state): Likewise.
(map_regcache_remote_table): Likewise.
(remote_register_number_and_offset): Likewise.
(init_remote_state): Likewise.
(get_memory_packet_size): Likewise.
(remote_pass_signals): Likewise.
(remote_program_signals): Likewise.
(remote_start_remote): Likewise.
(remote_check_symbols): Likewise.
(remote_query_supported): Likewise.
(extended_remote_attach): Likewise.
(process_g_packet): Likewise.
(store_registers_using_G): Likewise.
(putpkt_binary): Likewise.
(read_frame): Likewise.
(compare_sections_command): Likewise.
(remote_hostio_pread): Likewise.
(remote_hostio_readlink): Likewise.
(remote_file_put): Likewise.
(remote_file_get): Likewise.
(remote_pid_to_exec_file): Likewise.
(_initialize_remote): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
(bfd_uses_spe_extensions): Likewise.
* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
* solib-dsbt.c (decode_loadmap): Likewise.
(fetch_loadmap): Likewise.
(scan_dyntag): Likewise.
(enable_break): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (fetch_loadmap): Likewise.
(enable_break2): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_relocate_main_executable): Likewise.
(spu_bfd_open): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(read_program_header): Likewise.
(find_program_interpreter): Likewise.
(scan_dyntag): Likewise.
(elf_locate_base): Likewise.
(open_symbol_file_object): Likewise.
(read_program_headers_from_bfd): Likewise.
(svr4_relocate_main_executable): Likewise.
* solib-target.c (solib_target_relocate_section_addresses): Likewise.
* solib.c (solib_find_1): Likewise.
(exec_file_find): Likewise.
(solib_find): Likewise.
* source.c (openp): Likewise.
(print_source_lines_base): Likewise.
(forward_search_command): Likewise.
* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
* spu-tdep.c (spu2ppu_prev_register): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (patch_block_stabs): Likewise.
(define_symbol): Likewise.
(again:): Likewise.
(read_member_functions): Likewise.
(read_one_struct_field): Likewise.
(read_enum_type): Likewise.
(common_block_start): Likewise.
* stack.c (read_frame_arg): Likewise.
(backtrace_command): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
* symfile.c (syms_from_objfile_1): Likewise.
(find_separate_debug_file): Likewise.
(load_command): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(reread_symbols): Likewise.
(add_filename_language): Likewise.
(allocate_compunit_symtab): Likewise.
(read_target_long_array): Likewise.
(simple_read_overlay_table): Likewise.
* symtab.c (symbol_set_names): Likewise.
(resize_symbol_cache): Likewise.
(rbreak_command): Likewise.
(completion_list_add_name): Likewise.
(completion_list_objc_symbol): Likewise.
(add_filename_to_list): Likewise.
* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
* target-memory.c (target_write_memory_blocks): Likewise.
* target.c (target_read_string): Likewise.
(read_whatever_is_readable): Likewise.
(target_read_alloc_1): Likewise.
(simple_search_memory): Likewise.
(target_fileio_read_alloc_1): Likewise.
* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
* top.c (command_line_input): Likewise.
* tracefile-tfile.c (tfile_fetch_registers): Likewise.
* tracefile.c (tracefile_fetch_registers): Likewise.
* tracepoint.c (add_memrange): Likewise.
(init_collection_list): Likewise.
(add_aexpr): Likewise.
(trace_dump_actions): Likewise.
(parse_trace_status): Likewise.
(parse_tracepoint_definition): Likewise.
(parse_tsv_definition): Likewise.
(parse_static_tracepoint_marker_definition): Likewise.
* tui/tui-file.c (tui_sfileopen): Likewise.
(tui_file_adjust_strbuf): Likewise.
* tui/tui-io.c (tui_expand_tabs): Likewise.
* tui/tui-source.c (tui_set_source_content): Likewise.
* typeprint.c (find_global_typedef): Likewise.
* ui-file.c (do_ui_file_xstrdup): Likewise.
(ui_file_obsavestring): Likewise.
(mem_file_write): Likewise.
* utils.c (make_hex_string): Likewise.
(get_regcomp_error): Likewise.
(puts_filtered_tabular): Likewise.
(gdb_realpath_keepfile): Likewise.
(ldirname): Likewise.
(gdb_bfd_errmsg): Likewise.
(substitute_path_component): Likewise.
* valops.c (search_struct_method): Likewise.
(find_oload_champ_namespace_loop): Likewise.
* valprint.c (print_decimal_chars): Likewise.
(read_string): Likewise.
(generic_emit_char): Likewise.
* varobj.c (varobj_delete): Likewise.
(varobj_value_get_print_value): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
* windows-tdep.c (display_one_tib): Likewise.
* xcoffread.c (read_xcoff_symtab): Likewise.
(process_xcoff_symbol): Likewise.
(swap_sym): Likewise.
(scan_xcoff_symtab): Likewise.
(xcoff_initial_scan): Likewise.
* xml-support.c (gdb_xml_end_element): Likewise.
(xml_process_xincludes): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (xml_list_of_syscalls): Likewise.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.

gdb/gdbserver/ChangeLog:

* ax.c (gdb_parse_agent_expr): Add cast to allocation result
assignment.
(gdb_unparse_agent_expr): Likewise.
* hostio.c (require_data): Likewise.
(handle_pread): Likewise.
* linux-low.c (disable_regset): Likewise.
(fetch_register): Likewise.
(store_register): Likewise.
(get_dynamic): Likewise.
(linux_qxfer_libraries_svr4): Likewise.
* mem-break.c (delete_fast_tracepoint_jump): Likewise.
(set_fast_tracepoint_jump): Likewise.
(uninsert_fast_tracepoint_jumps_at): Likewise.
(reinsert_fast_tracepoint_jumps_at): Likewise.
(validate_inserted_breakpoint): Likewise.
(clone_agent_expr): Likewise.
* regcache.c (init_register_cache): Likewise.
* remote-utils.c (putpkt_binary_1): Likewise.
(decode_M_packet): Likewise.
(decode_X_packet): Likewise.
(look_up_one_symbol): Likewise.
(relocate_instruction): Likewise.
(monitor_output): Likewise.
* server.c (handle_search_memory): Likewise.
(handle_qxfer_exec_file): Likewise.
(handle_qxfer_libraries): Likewise.
(handle_qxfer): Likewise.
(handle_query): Likewise.
(handle_v_cont): Likewise.
(handle_v_run): Likewise.
(captured_main): Likewise.
* target.c (write_inferior_memory): Likewise.
* thread-db.c (try_thread_db_load_from_dir): Likewise.
* tracepoint.c (init_trace_buffer): Likewise.
(add_tracepoint_action): Likewise.
(add_traceframe): Likewise.
(add_traceframe_block): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtdv): Likewise.
(cmd_qtstatus): Likewise.
(response_source): Likewise.
(response_tsv): Likewise.
(cmd_qtnotes): Likewise.
(gdb_collect): Likewise.
(initialize_tracepoint): Likewise.

9 years ago[PATCH] Add micromips support to the MIPS simulator
Andrew Bennett [Fri, 25 Sep 2015 14:52:18 +0000 (15:52 +0100)]
[PATCH] Add micromips support to the MIPS simulator

2015-09-25  Andrew Bennett  <andrew.bennett@imgtec.com>
        Ali Lown  <ali.lown@imgtec.com>

sim/common/
* sim-bits.h (EXTEND6): New macro.
(EXTEND12): New macro.
(EXTEND25): New macro.

sim/mips/
* Makefile.in (tmp-micromips): New rule.
(tmp-mach-multi): Add support for micromips.
* configure.ac (mips*-sde-elf* | mips*-mti-elf*): Made a multi sim
that works for both mips64 and micromips64.
(mipsisa32r2*-*-*): Made a multi sim that works for mips32 and
micromips32.
Add build support for micromips.
* dsp.igen (do_ph_s_absq, do_w_s_absq, do_qb_s_absq, do_addsc,
do_addwc, do_bitrev, do_extpv, do_extrv, do_extrv_s_h, do_insv,
do_lxx do_modsub, do_mthlip, do_mulsaq_s_w_ph, do_ph_packrl, do_qb_pick
do_ph_pick, do_qb_ph_precequ, do_qb_ph_preceu, do_w_preceq
do_w_ph_precrq, do_ph_qb_precrq, do_w_ph_rs_precrq do_qb_w_raddu,
do_rddsp, do_repl, do_shilov, do_ph_shl, do_qb_shl do_w_s_shllv,
do_ph_shrlv, do_w_r_shrav, do_wrdsp, do_qb_shrav, do_append,
do_balign, do_ph_w_mulsa, do_ph_qb_precr, do_prepend): New functions.
Refactored instruction code to use these functions.
* dsp2.igen: Refactored instruction code to use the new functions.
* interp.c (decode_coproc): Refactored to work with any instruction
encoding.
(isa_mode): New variable
(RSVD_INSTRUCTION): Changed to 0x00000039.
* m16.igen (BREAK16): Refactored instruction to use do_break16.
(JALX32): Add mips32, mips64, mips32r2 and mips64r2 models.
* micromips.dc: New file.
* micromips.igen: New file.
* micromips16.dc: New file.
* micromipsdsp.igen: New file.
* micromipsrun.c: New file.
* mips.igen (do_swc1): Changed to work with any instruction encoding.
(do_add do_addi do_andi do_dadd do_daddi do_dsll32 do_dsra32
do_dsrl32, do_dsub, do_break, do_break16, do_clo, do_clz, do_dclo
do_dclz, do_lb, do_lh, do_lwr, do_lwl, do_lwc, do_lw, do_lwu, do_lhu
do_ldc, do_lbu, do_ll, do_lld, do_lui, do_madd, do_dsp_madd, do_maddu
do_dsp_maddu, do_dsp_mfhi, do_dsp_mflo, do_movn, do_movz, do_msub
do_dsp_msub, do_msubu, do_dsp_msubu, do_mthi, do_dsp_mthi, do_mtlo
do_dsp_mtlo, do_mul, do_dsp_mult, do_dsp_multu, do_pref, do_sc, do_scd
do_sub, do_sw, do_teq, do_teqi, do_tge, do_tgei, do_tgeiu, do_tgeu, do_tlt
do_tlti, do_tltiu, do_tltu, do_tne, do_tnei, do_abs_fmt, do_add_fmt
do_alnv_ps, do_c_cond_fmt, do_ceil_fmt, do_cfc1, do_ctc1, do_cvt_d_fmt
do_cvt_l_fmt, do_cvt_ps_s, do_cvt_s_fmt, do_cvt_s_pl, do_cvt_s_pu
do_cvt_w_fmt, do_div_fmt, do_dmfc1b, do_dmtc1b, do_floor_fmt, do_luxc1_32
do_luxc1_64, do_lwc1, do_lwxc1, do_madd_fmt, do_mfc1b, do_mov_fmt, do_movtf
do_movtf_fmt, do_movn_fmt, do_movz_fmt, do_msub_fmt, do_mtc1b, do_mul_fmt
do_neg_fmt, do_nmadd_fmt, do_nmsub_fmt, do_pll_ps, do_plu_ps, do_pul_ps
do_puu_ps, do_recip_fmt, do_round_fmt, do_rsqrt_fmt, do_prefx, do_sdc1
do_suxc1_32, do_suxc1_64, do_sqrt_fmt, do_sub_fmt, do_swc1, do_swxc1
do_trunc_fmt): New functions, refactored from existing instructions.
Refactored instruction code to use these functions.
(RSVD): Changed to use new reserved instruction.
(loadstore_ea, not_word_value, unpredictable, check_mt_hilo, check_mf_hilo,
check_mult_hilo, check_div_hilo, check_u64, do_luxc1_32, do_sdc1, do_suxc1_32,
check_fmt_p, check_fpu, do_load_double, do_store_double):  Added micromips32
and micromips64 models.
Added include for micromips.igen and micromipsdsp.igen
Add micromips32 and micromips64 models.
(DecodeCoproc): Updated to use new macro definition.
* mips3264r2.igen (do_dsbh, do_dshd, do_dext, do_dextm, do_dextu, do_di,
do_dins, do_dinsm, do_ei, do_ext, do_mfhc1, do_mthc1, do_ins, do_dinsu,
do_seb, do_seh do_rdhwr, do_wsbh): New functions.
Refactored instruction code to use these functions.
* sim-main.h (CP0_operation): New enum.
(DecodeCoproc): Updated macro.
(IMEM32_MICROMIPS, IMEM16_MICROMIPS, MICROMIPS_MINOR_OPCODE,
MICROMIPS_DELAYSLOT_SIZE_ANY, MICROMIPS_DELAYSLOT_SIZE_16, MICROMIPS_DELAYSLOT_SIZE_32,
ISA_MODE_MIPS32 and ISA_MODE_MICROMIPS): New defines.
(sim_state): Add isa_mode field.

sim/testsuite/sim/mips/
       * basic.exp (run_micromips_test, run_sim_tests): New functions
Add support for micromips tests.
* hilo-hazard-4.s: New file.
* testutils.inc (_dowrite): Changed reserved instruction encoding.
(writemsg): Moved the la and li instructions before the data they are
assigned to, which prevents a bug where MIPS32 relocations are used instead
of micromips relocations when building for micromips.

9 years agoCorrect the generation of OR1K pc-relative relocations.
Peter Zotov [Fri, 25 Sep 2015 14:21:14 +0000 (15:21 +0100)]
Correct the generation of OR1K pc-relative relocations.

gas PR ld/18759
* config/tc-or1k.c (tc_gen_reloc): Correct computation of PC
relative relocs.
* config/tc-or1k.h (GAS_CGEN_PRCEL_R_TYPE): Delete.

bfd * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
(R_OR1K_16_PCREL): Likewise.
(R_OR1K_8_PCREL): Likewise.

ld/tests * ld-elf/eh-frame-hdr: Expect to pass on the or1k-linux target.

9 years agoPOSIX shell compatibility of gas/configure.ac
Ryo ONODERA [Fri, 25 Sep 2015 02:03:17 +0000 (11:33 +0930)]
POSIX shell compatibility of gas/configure.ac

* configure.ac (nds32): Don't use bash == in tests.
* configure: Regenerate.

9 years agoGeneralize enum regexp in gdb.cp/classes.exp.
Sandra Loosemore [Fri, 25 Sep 2015 01:22:57 +0000 (18:22 -0700)]
Generalize enum regexp in gdb.cp/classes.exp.

2015-09-24 Sandra Loosemore <sandra@codesourcery.com>

gdb/testsuite/
* gdb.cp/classes.exp (test_enums): Generalize regexp to allow
short or char as base type.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Sep 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAccidentally added file. Removed it.
jamesbowman [Thu, 24 Sep 2015 23:40:41 +0000 (16:40 -0700)]
Accidentally added file. Removed it.

9 years agoTest case, disassembler not showing RIMM literals correctly #14
jamesbowman [Thu, 24 Sep 2015 23:31:00 +0000 (16:31 -0700)]
Test case, disassembler not showing RIMM literals correctly #14

9 years ago[FT32] Implement pointer to address conversion method.
jamesbowman [Thu, 24 Sep 2015 23:07:35 +0000 (16:07 -0700)]
[FT32] Implement pointer to address conversion method.

FT32 is a Harvard architecture with two address spaces -- RAM and flash.
The patch properly implements the pointer to address conversion method.
There are some other small fixes to handle address spaces.

gdb/
* ft32-tdep.c (ft32_register_type): Return gdbarch_tdep
(gdbarch)->pc_type instead of builtin_func_ptr.
(ft32_pointer_to_address): New function.
(ft32_address_class_type_flags): New function.
(ft32_address_class_type_flags_to_name): New function.
(ft32_address_class_name_to_type_flags): New function.
(ft32_gdbarch_init): Set tdep->pc_type.  Call
set_gdbarch_pointer_to_address,
set_gdbarch_address_class_type_flags
set_gdbarch_address_class_name_to_type_flags,
and set_gdbarch_address_class_type_flags_to_name.
* ft32-tdep.h (struct gdbarch_tdep) <pc_type>: New field.

9 years agoRelative DT_RPATH/DT_RUNPATH vs. sysroot capable ld.
Alan Modra [Thu, 24 Sep 2015 03:43:57 +0000 (13:13 +0930)]
Relative DT_RPATH/DT_RUNPATH vs. sysroot capable ld.

This fixes two problems.  First, the --sysroot option wasn't available
with a ld configured without --with-sysroot, a historical accident.
This led to people configuring binutils with --with-sysroot=/ in order
to enable sysroot support, which exposes a case where ld wrongly
prepends the sysroot to a relative path.

PR ld/18992
* ldmain.c (main): Always enable --sysroot.
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't
prepend sysroot to relative rpath/runpath.

9 years agoAllow any size enum in gdb.cp/var-tag.exp.
Sandra Loosemore [Thu, 24 Sep 2015 00:12:07 +0000 (17:12 -0700)]
Allow any size enum in gdb.cp/var-tag.exp.

2015-09-23 Sandra Loosemore <sandra@codesourcery.com>

gdb/testsuite/
* gdb.cp/var-tag.exp (do_global_tests): Generalize opt_underlying
to allow any size enum.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Sep 2015 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years ago[Ada] Fix handling of array renamings
Pierre-Marie de Rodat [Tue, 1 Sep 2015 14:18:40 +0000 (16:18 +0200)]
[Ada] Fix handling of array renamings

Compilers can materialize renamings of arrays (or of accesses to arrays)
in Ada into variables whose types are references to the actual array
types.  Before this change, trying to use such an array renaming yielded
an error in GDB:

    (gdb) print my_array(1)
    cannot subscript or call a record
    (gdb) print my_array_ptr(1)
    cannot subscript or call something of type `(null)'

This behavior comes from bad handling for array renamings, in particular
the OP_FUNCALL expression operator handling from ada-lang.c
(ada_evaluate_subexp): in one place we turn the reference into a
pointer, but the code that follows expect the value to be an array.

This patch fixes how we handle references in call/subscript evaluation
so that we turn these references into the actual array values instead of
pointers to them.

gdb/ChangeLog:

* ada-lang.c (ada_evaluate_subexp) <OP_FUNCALL>: When the input
value is a reference, actually dereference it in order to get
the underlying value.

gdb/testsuite/ChangeLog:

* gdb.ada/array_ptr_renaming.exp: New testcase.
* gdb.ada/array_ptr_renaming/foo.adb: New file.
* gdb.ada/array_ptr_renaming/pack.ads: New file.

Tested on x86_64-linux, no regression.

9 years agoFix compile time warnings generated when compiling with clang.
Nick Clifton [Wed, 23 Sep 2015 17:05:16 +0000 (18:05 +0100)]
Fix compile time warnings generated when compiling with clang.

bfd * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
order to avoid problems with left shifting negative values.
(abs32code): Likewise.
* mach-o.c (FILE_ALIGN): Likewise.
* coff-rs6000.c (xcoff_debug_sections): Delete unused static
array.
* elf32-visium.c (visium_reloc_map): Likewise.
* elf32-arm.c (elf32_arm_final_link_relocate): Remove useless
calls to abs function.
* elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise.
* elf32-score.c (score_elf_final_link_relocate): Likewise.
* elf32-score7.c (score_elf_final_link_relocate): Likewise.
* elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead
of shifting to create a negative mask.
* elf32-msp430.c (elf_backend_special_sections): Define.
* elfxx-mips.c (got_ofst_reloc_p): Delete unused function.
(got_hi16_reloc_p): Delete unused function.
* ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of
partition name.

gas * config/tc-ppc.c (insn_validate): Cast PPC_OPSHIFT_INV to an int.

opcode * ppc.h (PPC_OPSHIFT_INV): Use an unsigned constant when left
shifting.

ld * emultempl/elf32.em (ehdr_start_empty): New static variable.
(before_allocation): Use it to initialise ehdr_start_save.
* emultempl/pe.em (write_build_id): Remove useless double
parenthesis.
* emultempl/pep.em (write_build_id): Likewise.

opcodes * bfin-dis.c (fmtconst): Remove unnecessary call to the abs
function.
* tic30-dis.c (print_branch): Likewise.
* cgen-asm.c (cgen_parse_signed_integer): Cast integer to signed
value before left shifting.
* fr30-ibld.c (fr30_cgen_extract_operand): Likewise.
* hppa-dis.c (print_insn_hppa): Likewise.
* mips-dis.c (mips_cp0sel_names_mipsr5900): Delete unused static
array.
* msp430-dis.c (msp430_singleoperand): Likewise.
(msp430_doubleoperand): Likewise.
(print_insn_msp430): Likewise.
* nds32-asm.c (parse_operand): Likewise.
* sh-opc.h (MASK): Likewise.
* v850-dis.c (get_operand_value): Likewise.

9 years agoAdd support for files that contain multiple symbol index tables. Fixes PR 15835
Nick Clifton [Wed, 23 Sep 2015 16:23:58 +0000 (17:23 +0100)]
Add support for files that contain multiple symbol index tables.  Fixes PR 15835

binutils PR binutils/15835
* readelf.c (struct elf_section_list): New structure.
(symtab_shndx_hdr): Replace with symtab_shndx_list.
(get_32bit_elf_symbols): Scan for a symbol index table matching
the symbol table in use.
(get_64bit_elf_symbols): Likewise.
(process_section_headers): Handle multiple symbol index sections.

bfd * elf-bfd.h (struct elf_section_list): New structure.
(struct elf_obj_tdata): Replace symtab_shndx_hdr with
symtab_shndx_list.  Delete symtab_shndx_section.
(elf_symtab_shndx): Replace macro with elf_symtab_shndx_list.
* elf.c (bfd_elf_get_syms): If symtab index sections are present,
scan them for the section that matches the provided symbol table.
(bfd_section_from_shdr): Record all SHT_SYMTAB_SHNDX sections.
(assign_section_numbers): Use the first symtab index table in the
list.
(_bfd_elf_compute_section_file_positions): Replace use of
symtab_shndx_hdr with use of symtab_shndx_list.
(find_section_in_list): New function.
(assign_file_postions_except_relocs): Use new function.
(_bfd_elf_copy_private_symbol_data): Likewise.
(swap_out_syms): Handle multiple symbol table index sections.
* elf32-m32c.c (m32c_elf_relax_section): Replace use of
symtab_shndx_hdr with use of symtab_shndx_list.
* elf32-rl78.c (rl78_elf_relax_section): Likewise.
* elf32-rx.c (rx_relax_section): Likewise.
* elf32-v850.c (v850_elf_relax_delete_bytes): Likewise.
* elflink.c (bfd_elf_final_link): Likewise.

9 years agosim: ft32: add character input port
James Bowman [Wed, 23 Sep 2015 02:43:56 +0000 (22:43 -0400)]
sim: ft32: add character input port

The FT32 simulator has character output, of course. This patch
adds character input, which lets the simulator run interactive
FT32 applications, e.g. language interpreters.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Sep 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agodoc: Fix substitute-path example
Simon Marchi [Tue, 22 Sep 2015 20:41:08 +0000 (16:41 -0400)]
doc: Fix substitute-path example

Found by Marc Khouzam.

gdb/doc/ChangeLog:

* gdb.texinfo (Specifying Source Directories): Fix
substitute-path example.

9 years agoUpdate MIPS PIE tests for DF_1_PIE change
H.J. Lu [Tue, 22 Sep 2015 18:12:01 +0000 (11:12 -0700)]
Update MIPS PIE tests for DF_1_PIE change

Since linker now sets the DF_1_PIE bit in the DT_FLAGS_1 tag for PIE,
we need to update MIPS PIE tests for it.

* ld-mips-elf/pie-n32.d: Updated.
* ld-mips-elf/pie-n64.d: Likewise.
* ld-mips-elf/pie-o32.d: Likewise.

9 years agoChange 7-byte NOP instruction for RX target, so that it only takes 1 cycle to excute.
Nick Clifton [Tue, 22 Sep 2015 16:32:28 +0000 (17:32 +0100)]
Change 7-byte NOP instruction for RX target, so that it only takes 1 cycle to excute.

* config/tc-rx.c (nop_7): Recode using MAX.

9 years agoEnhance the RX disassembler to detect and report bad instructions.
Nick Clifton [Tue, 22 Sep 2015 16:21:13 +0000 (17:21 +0100)]
Enhance the RX disassembler to detect and report bad instructions.

opcode * rx.h (enum RX_Size): Add RX_Bad_Size entry.

opcodes * rx-decode.opc (bwl): Use RX_Bad_Size.
(sbwl): Likewise.
(ubwl): Likewise.  Rename to ubw.
(uBWL): Rename to uBW.
Replace all references to uBWL with uBW.
* rx-decode.c: Regenerate.
* rx-dis.c (size_names): Add entry for RX_Bad_Size.
(opsize_names): Likewise.
(print_insn_rx): Detect and report RX_Bad_Size.

9 years agostap-probe: Remove unnecessary cast
Simon Marchi [Tue, 22 Sep 2015 15:17:52 +0000 (11:17 -0400)]
stap-probe: Remove unnecessary cast

ret->args_u.text is const char *, probe_args is const char *, so no cast
is needed.  Found while doing cxx-conversion stuff, since it wouldn't
build in C++.

gdb/ChangeLog:

* stap-probe.c (handle_stap_probe): Remove unnecessary cast.

9 years agoSet DF_1_PIE in gld${EMULATION_NAME}_after_parse
H.J. Lu [Tue, 22 Sep 2015 13:08:55 +0000 (06:08 -0700)]
Set DF_1_PIE in gld${EMULATION_NAME}_after_parse

We can't add OPTION_PIE to gld${EMULATION_NAME}_handle_option since
it has been handled in parse_args in lexsup.c.  This patch moves
setting DF_1_PIE to gld${EMULATION_NAME}_after_parse.

ld/

* emultempl/alphaelf.em (alpha_after_parse): Call
gld${EMULATION_NAME}_after_parse instead of
after_parse_default.
* emultempl/cr16elf.em (cr16elf_after_parse): Likewise.
* emultempl/crxelf.em (crxelf_after_parse); Likewise.
* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
* emultempl/mipself.em (mips_after_parse): Likewise.
* emultempl/nds32elf.em (nds32_elf_after_parse): Likewise.
* emultempl/elf32.em: Don't include ldlex.h.
(gld${EMULATION_NAME}_after_parse): New function.
(gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT]
<OPTION_PIE>: Removed.
(ld_${EMULATION_NAME}_emulation): Replace after_parse_default
with gld${EMULATION_NAME}_after_parse.
* emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse):
Renamed to ...
(ia64elf_after_parse): This.  Call
gld${EMULATION_NAME}_after_parse instead of after_parse_default.
(LDEMUL_AFTER_PARSE): Replace gld${EMULATION_NAME}_after_parse
with ia64elf_after_parse.

ld/testsuite/

* ld-elf/pie.d: New test.

9 years agoSolaris PIE support
Rainer Orth [Tue, 22 Sep 2015 09:12:51 +0000 (11:12 +0200)]
Solaris PIE support

include/elf:
* common.h (DF_1_STUB, DF_1_PIE): Define.

ld:
* emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes.

* emultempl/elf32.em: Include ldlex.h.
(gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT]
<OPTION_PIE>: Set DF_1_PIE.

binutils:
* readelf.c (process_dynamic_section): Handle DF_1_STUB, DF_1_PIE.

9 years agoopcodes/ppc-opc.c: Add dscr and ctrl SPR mnemonics
Anton Blanchard [Tue, 22 Sep 2015 05:39:24 +0000 (15:39 +1000)]
opcodes/ppc-opc.c: Add dscr and ctrl SPR mnemonics

opcodes/
* ppc-opc.c (powerpc_opcodes): Add mfdscr, mfctrl, mtdscr and mtctrl.

9 years agoUse bfd_get_32 and bfd_put_32 to access ch_type
H.J. Lu [Tue, 22 Sep 2015 02:38:40 +0000 (19:38 -0700)]
Use bfd_get_32 and bfd_put_32 to access ch_type

The ch_type field in Elf64_External_Chdr is 4 bytes.  We should use
bfd_get_32 and bfd_put_32 to access it.

* bfd.c (bfd_update_compression_header): Use bfd_put_32 on
ch_type.
(bfd_check_compression_header): Use bfd_get_32 on ch_type.
(bfd_convert_section_contents): Use bfd_get_32 and bfd_put_32
on ch_type.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFormat ld option items
Alan Modra [Mon, 21 Sep 2015 23:40:44 +0000 (09:10 +0930)]
Format ld option items

* ld.texinfo: Put --dotsyms/--no-dotsyms on separate lines.
Ditto for --save-restore-funcs and --tls-get-addr-optimize.

9 years agoAdd two missing consts
Simon Marchi [Mon, 21 Sep 2015 22:47:33 +0000 (18:47 -0400)]
Add two missing consts

Two missing consts, found while doing cxx-conversion work.  We end up
with a char*, even though we pass a const char* to strstr.  I am pushing
this as obvious.

gdb/ChangeLog:

* cli/cli-setshow.c (cmd_show_list): Constify a variable.
* linespec.c (linespec_lexer_lex_string): Same.

9 years agoChange ch_type in Elf64_External_Chdr to 4 bytes
H.J. Lu [Mon, 21 Sep 2015 17:19:25 +0000 (10:19 -0700)]
Change ch_type in Elf64_External_Chdr to 4 bytes

The ch_type field in Elf64_External_Chdr is 4 bytes, followed by a
4-byte padding.  This change doesn't introduce any functional change
since only the lower 32 bits of the ch_type field are used.

* external.h (Elf64_External_Chdr): Change ch_type to 4 bytes
and add ch_reserved.

9 years agoAdd NEWS entry for fast tracepoint support on aarch64-linux
Pierre Langlois [Mon, 21 Sep 2015 14:01:05 +0000 (15:01 +0100)]
Add NEWS entry for fast tracepoint support on aarch64-linux

Here is a NEWS entry for this series:

gdb/ChangeLog:

* NEWS: Mention support for fast tracepoints on aarch64-linux.

9 years agoAdd a test case for fast tracepoints' locking mechanism
Pierre Langlois [Mon, 21 Sep 2015 14:01:05 +0000 (15:01 +0100)]
Add a test case for fast tracepoints' locking mechanism

When installing a fast tracepoint, we create a jump pad with a
spin-lock.  This way, only one thread can collect a given tracepoint at
any time.  This test case checks that this lock actually works as
expected.

This test works by creating a function which overrides the in-process
agent library's gdb_collect function.  On start up, GDBserver will ask
GDB with the 'qSymbol' packet about symbols present in the inferior.
GDB will reply with the gdb_agent_gdb_collect function from the test
case instead of the one from the agent.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace-lock.c: New file.
* gdb.trace/ftrace-lock.exp: New file.

9 years agoAdd a gdb.trace test for instruction relocation
Pierre Langlois [Mon, 21 Sep 2015 14:01:05 +0000 (15:01 +0100)]
Add a gdb.trace test for instruction relocation

This test case makes sure that relocating PC relative instructions does
not change their behaviors.  All PC relative AArch64 instructions are
covered.  While call and jump (32 bit relative) instructions are covered
on x86.

The test case creates a static array of function pointers for each
supported architecture.  Each function in this array tests a specific
instruction using inline assembly.  They all need to contain a symbol in
the form of 'set_point\[0-9\]+' and finish by either calling pass or
fail.  The number of 'set_pointN' needs to go from 0 to
(ARRAY_SIZE - 1).

The test will:
- look up the number of function pointers in the static array.
- set fast tracepoints on each 'set_point\[0-9\]+' symbol, one in each
  functions from 0 to (ARRAY_SIZE - 1).
- run the trace experiment and make sure the pass function is called for
  every function.

gdb/testsuite/ChangeLog:

* gdb.arch/insn-reloc.c: New file.
* gdb.arch/ftrace-insn-reloc.exp: New file.

9 years agoEnable fast tracepoint tests
Pierre Langlois [Mon, 21 Sep 2015 14:01:05 +0000 (15:01 +0100)]
Enable fast tracepoint tests

gdb/testsuite/ChangeLog:

* gdb.trace/change-loc.h (func4) [__aarch64__]: Add a nop
instruction.
* gdb.trace/pendshr1.c (pendfunc): Likewise.
* gdb.trace/pendshr2.c (pendfunc2): Likewise.
* gdb.trace/range-stepping.c: Likewise.
* gdb.trace/trace-break.c: Likewise.
* gdb.trace/trace-mt.c (thread_function): Likewise.
* gdb.trace/ftrace.c (marker): Likewise.
* gdb.trace/trace-condition.c (marker): Likewise.
* gdb.trace/ftrace.exp: Enable ftrace test if is_aarch64_target.
* gdb.trace/trace-condition.exp: Set pcreg to "\$pc" if
is_aarch64_target.

9 years agoImplement target_emit_ops
Pierre Langlois [Mon, 21 Sep 2015 14:01:04 +0000 (15:01 +0100)]
Implement target_emit_ops

This patch implements compiling agent expressions to native code for
AArch64.  This allows us to compile conditions set on fast tracepoints.

The compiled function has the following prologue:

High *------------------------------------------------------*
     | LR                                                   |
     | FP                                                   | <- FP
     | x1  (ULONGEST *value)                                |
     | x0  (unsigned char *regs)                            |
Low  *------------------------------------------------------*

We save the function's argument on the stack as well as the return
address and the frame pointer.  We then set the current frame pointer to
point to the previous one.

The generated code for the expression will freely update the stack
pointer so we use the frame pointer to refer to `*value' and `*regs'.
`*value' needs to be accessed in the epilogue of the function, in order
to set it to whatever is on top of the stack.  `*regs' needs to be passed
down to the `gdb_agent_get_raw_reg' function with the `reg' operation.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low-.c: Include ax.h and tracepoint.h.
(enum aarch64_opcodes) <RET>, <SUBS>, <AND>, <ORR>, <ORN>,
<EOR>, <LSLV>, <LSRV>, <ASRV>, <SBFM>, <UBFM>, <CSINC>, <MUL>,
<NOP>: New.
(enum aarch64_condition_codes): New enum.
(w0): New static global.
(fp): Likewise.
(lr): Likewise.
(struct aarch64_memory_operand) <type>: New
MEMORY_OPERAND_POSTINDEX type.
(postindex_memory_operand): New helper function.
(emit_ret): New function.
(emit_load_store_pair): New function, factored out of emit_stp
with support for MEMORY_OPERAND_POSTINDEX.
(emit_stp): Rewrite using emit_load_store_pair.
(emit_ldp): New function.
(emit_load_store): Likewise.
(emit_ldr): Mention post-index instruction in comment.
(emit_ldrh): New function.
(emit_ldrb): New function.
(emit_ldrsw): Mention post-index instruction in comment.
(emit_str): Likewise.
(emit_subs): New function.
(emit_cmp): Likewise.
(emit_and): Likewise.
(emit_orr): Likewise.
(emit_orn): Likewise.
(emit_eor): Likewise.
(emit_mvn): Likewise.
(emit_lslv): Likewise.
(emit_lsrv): Likewise.
(emit_asrv): Likewise.
(emit_mul): Likewise.
(emit_sbfm): Likewise.
(emit_sbfx): Likewise.
(emit_ubfm): Likewise.
(emit_ubfx): Likewise.
(emit_csinc): Likewise.
(emit_cset): Likewise.
(emit_nop): Likewise.
(emit_ops_insns): New helper function.
(emit_pop): Likewise.
(emit_push): Likewise.
(aarch64_emit_prologue): New function.
(aarch64_emit_epilogue): Likewise.
(aarch64_emit_add): Likewise.
(aarch64_emit_sub): Likewise.
(aarch64_emit_mul): Likewise.
(aarch64_emit_lsh): Likewise.
(aarch64_emit_rsh_signed): Likewise.
(aarch64_emit_rsh_unsigned): Likewise.
(aarch64_emit_ext): Likewise.
(aarch64_emit_log_not): Likewise.
(aarch64_emit_bit_and): Likewise.
(aarch64_emit_bit_or): Likewise.
(aarch64_emit_bit_xor): Likewise.
(aarch64_emit_bit_not): Likewise.
(aarch64_emit_equal): Likewise.
(aarch64_emit_less_signed): Likewise.
(aarch64_emit_less_unsigned): Likewise.
(aarch64_emit_ref): Likewise.
(aarch64_emit_if_goto): Likewise.
(aarch64_emit_goto): Likewise.
(aarch64_write_goto_address): Likewise.
(aarch64_emit_const): Likewise.
(aarch64_emit_call): Likewise.
(aarch64_emit_reg): Likewise.
(aarch64_emit_pop): Likewise.
(aarch64_emit_stack_flush): Likewise.
(aarch64_emit_zero_ext): Likewise.
(aarch64_emit_swap): Likewise.
(aarch64_emit_stack_adjust): Likewise.
(aarch64_emit_int_call_1): Likewise.
(aarch64_emit_void_call_2): Likewise.
(aarch64_emit_eq_goto): Likewise.
(aarch64_emit_ne_goto): Likewise.
(aarch64_emit_lt_goto): Likewise.
(aarch64_emit_le_goto): Likewise.
(aarch64_emit_gt_goto): Likewise.
(aarch64_emit_ge_got): Likewise.
(aarch64_emit_ops_impl): New static global variable.
(aarch64_emit_ops): New target function, return
&aarch64_emit_ops_impl.
(struct linux_target_ops): Install it.

9 years agoAdd support for fast tracepoints
Pierre Langlois [Mon, 21 Sep 2015 14:01:04 +0000 (15:01 +0100)]
Add support for fast tracepoints

This patch adds support for fast tracepoints for aarch64-linux.  With this
implementation, a tracepoint can only be placed in a +/- 128MB range of
the jump pad.  This is due to the unconditional branch instruction
being limited to a (26 bit << 2) offset from the current PC.

Three target operations are implemented:

- target_install_fast_tracepoint_jump_pad

Building the jump pad the biggest change of this patch.  We need to add
functions to emit all instructions needed to save and restore the
current state when the tracepoint is hit.  As well as implementing a
lock and creating a collecting_t object identifying the current thread.

Steps performed by the jump pad:

  * Save the current state on the stack.
  * Push a collecting_t object on the stack.  We read the special
  tpidr_el0 system register to get the thread ID.
  * Spin-lock on the shared memory location of all tracing threads.  We
  write the address of our collecting_t object there once we have the
  lock.
  * Call gdb_collect.
  * Release the lock.
  * Restore the state.

  * Execute the replaced instruction which will have been relocated.
  * Jump back to the program.

- target_get_thread_area

As implemented in ps_get_thread_area, target_get_thread_area uses ptrace
to fetch the NT_ARM_TLS register.  At the architecture level, NT_ARM_TLS
represents the tpidr_el0 system register.

So this ptrace call (if lwpid is the current thread):
~~~
ptrace (PTRACE_GETREGSET, lwpid, NT_ARM_TLS, &iovec);
~~~

Is equivalent to the following instruction:
~~~
msr x0, tpidr_el0
~~~

This instruction is used when creating the collecting_t object that
GDBserver can read to know if a given thread is currently tracing.

So target_get_thread_area must get the same thread IDs as what the jump
pad writes into its collecting_t object.

- target_get_min_fast_tracepoint_insn_len

This just returns 4.

gdb/gdbserver/ChangeLog:

* Makefile.in (linux-aarch64-ipa.o, aarch64-ipa.o): New rules.
* configure.srv (aarch64*-*-linux*): Add linux-aarch64-ipa.o and
aarch64-ipa.o.
* linux-aarch64-ipa.c: New file.
* linux-aarch64-low.c: Include arch/aarch64-insn.h, inttypes.h
and endian.h.
(aarch64_get_thread_area): New target method.
(extract_signed_bitfield): New helper function.
(aarch64_decode_ldr_literal): New function.
(enum aarch64_opcodes): New enum.
(struct aarch64_register): New struct.
(struct aarch64_operand): New struct.
(x0): New static global.
(x1): Likewise.
(x2): Likewise.
(x3): Likewise.
(x4): Likewise.
(w2): Likewise.
(ip0): Likewise.
(sp): Likewise.
(xzr): Likewise.
(aarch64_register): New helper function.
(register_operand): Likewise.
(immediate_operand): Likewise.
(struct aarch64_memory_operand): New struct.
(offset_memory_operand): New helper function.
(preindex_memory_operand): Likewise.
(enum aarch64_system_control_registers): New enum.
(ENCODE): New macro.
(emit_insn): New helper function.
(emit_b): New function.
(emit_bcond): Likewise.
(emit_cb): Likewise.
(emit_tb): Likewise.
(emit_blr): Likewise.
(emit_stp): Likewise.
(emit_ldp_q_offset): Likewise.
(emit_stp_q_offset): Likewise.
(emit_load_store): Likewise.
(emit_ldr): Likewise.
(emit_ldrsw): Likewise.
(emit_str): Likewise.
(emit_ldaxr): Likewise.
(emit_stxr): Likewise.
(emit_stlr): Likewise.
(emit_data_processing_reg): Likewise.
(emit_data_processing): Likewise.
(emit_add): Likewise.
(emit_sub): Likewise.
(emit_mov): Likewise.
(emit_movk): Likewise.
(emit_mov_addr): Likewise.
(emit_mrs): Likewise.
(emit_msr): Likewise.
(emit_sevl): Likewise.
(emit_wfe): Likewise.
(append_insns): Likewise.
(can_encode_int32_in): New helper function.
(aarch64_relocate_instruction): New function.
(aarch64_install_fast_tracepoint_jump_pad): Likewise.
(aarch64_get_min_fast_tracepoint_insn_len): Likewise.
(struct linux_target_ops): Install aarch64_get_thread_area,
aarch64_install_fast_tracepoint_jump_pad and
aarch64_get_min_fast_tracepoint_insn_len.

9 years agoMake aarch64_decode_adrp handle both ADR and ADRP instructions
Pierre Langlois [Mon, 21 Sep 2015 14:01:04 +0000 (15:01 +0100)]
Make aarch64_decode_adrp handle both ADR and ADRP instructions

We will need to decode both ADR and ADRP instructions in GDBserver.
This patch makes common code handle both cases, even if GDB only needs
to decode the ADRP instruction.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_analyze_prologue): New is_adrp
variable.  Call aarch64_decode_adr instead of
aarch64_decode_adrp.
* arch/aarch64-insn.h (aarch64_decode_adrp): Delete.
(aarch64_decode_adr): New function declaration.
* arch/aarch64-insn.c (aarch64_decode_adrp): Delete.
(aarch64_decode_adr): New function, factored out from
aarch64_decode_adrp to decode both adr and adrp instructions.

9 years agoMove instruction decoding into new arch/ directory
Pierre Langlois [Mon, 21 Sep 2015 14:01:04 +0000 (15:01 +0100)]
Move instruction decoding into new arch/ directory

This patch moves the following functions into the arch/ common
directory, in new files arch/aarch64-insn.{h,c}.  They are prefixed with
'aarch64_':

 - aarch64_decode_adrp
 - aarch64_decode_b
 - aarch64_decode_cb
 - aarch64_decode_tb

We will need them to implement fast tracepoints in GDBserver.

For consistency, this patch also adds the 'aarch64_' prefix to static
decoding functions that do not need to be shared right now.

V2:
 make sure the formatting issues propagated
 fix `gdbserver/configure.srv'.

gdb/ChangeLog:

* Makefile.in (ALL_64_TARGET_OBS): Add aarch64-insn.o.
(HFILES_NO_SRCDIR): Add arch/aarch64-insn.h.
(aarch64-insn.o): New rule.
* configure.tgt (aarch64*-*-elf): Add aarch64-insn.o.
(aarch64*-*-linux*): Likewise.
* arch/aarch64-insn.c: New file.
* arch/aarch64-insn.h: New file.
* aarch64-tdep.c: Include arch/aarch64-insn.h.
(aarch64_debug): Move to arch/aarch64-insn.c.  Declare in
arch/aarch64-insn.h.
(decode_add_sub_imm): Rename to ...
(aarch64_decode_add_sub_imm): ... this.
(decode_adrp): Rename to ...
(aarch64_decode_adrp): ... this.  Move to arch/aarch64-insn.c.
Declare in arch/aarch64-insn.h.
(decode_b): Rename to ...
(aarch64_decode_b): ... this.  Move to arch/aarch64-insn.c.
Declare in arch/aarch64-insn.h.
(decode_bcond): Rename to ...
(aarch64_decode_bcond): ... this.  Move to arch/aarch64-insn.c.
Declare in arch/aarch64-insn.h.
(decode_br): Rename to ...
(aarch64_decode_br): ... this.
(decode_cb): Rename to ...
(aarch64_decode_cb): ... this.  Move to arch/aarch64-insn.c.
Declare in arch/aarch64-insn.h.
(decode_eret): Rename to ...
(aarch64_decode_eret): ... this.
(decode_movz): Rename to ...
(aarch64_decode_movz): ... this.
(decode_orr_shifted_register_x): Rename to ...
(aarch64_decode_orr_shifted_register_x): ... this.
(decode_ret): Rename to ...
(aarch64_decode_ret): ... this.
(decode_stp_offset): Rename to ...
(aarch64_decode_stp_offset): ... this.
(decode_stp_offset_wb): Rename to ...
(aarch64_decode_stp_offset_wb): ... this.
(decode_stur): Rename to ...
(aarch64_decode_stur): ... this.
(decode_tb): Rename to ...
(aarch64_decode_tb): ... this.  Move to arch/aarch64-insn.c.
Declare in arch/aarch64-insn.h.
(aarch64_analyze_prologue): Adjust calls to renamed functions.

gdb/gdbserver/ChangeLog:

* Makefile.in (aarch64-insn.o): New rule.
* configure.srv (aarch64*-*-linux*): Add aarch64-insn.o.

9 years agoWrap gdb_agent_op_sizes by #ifndef IN_PROCESS_AGENT
Yao Qi [Mon, 21 Sep 2015 11:31:51 +0000 (12:31 +0100)]
Wrap gdb_agent_op_sizes by #ifndef IN_PROCESS_AGENT

Hi,
I see the following build warning with recent GCC built from mainline,

aarch64-none-linux-gnu-gcc -g -O2    -I. -I/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver -I/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/../common -I/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/../regformats -I/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/.. -I/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/../../include -I/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body -Wdeclaration-after-statement -Werror -DGDBSERVER  -DCONFIG_UST_GDB_INTEGRATION -fPIC -DIN_PROCESS_AGENT -fvisibility=hidden -c -o ax-ipa.o -MT ax-ipa.o -MMD -MP -MF .deps/ax-ipa.Tpo `echo " -Wall -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body -Wdeclaration-after-statement " | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"` /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/ax.c
/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/ax.c:73:28: error: 'gdb_agent_op_sizes' defined but not used [-Werror=unused-const-variable]
 static const unsigned char gdb_agent_op_sizes [gdb_agent_op_last] =
                            ^
cc1: all warnings being treated as errors

gdb_agent_op_sizes is only used in function is_goto_target, which is
defined inside #ifndef IN_PROCESS_AGENT.  This warning is not arch
specific, so GCC mainline for other targets should produce this warning
too, although this warning is triggered by enabling aarch64 fast
tracepoint.  The fix is to move gdb_agent_op_sizes to

gdb/gdbserver:

2015-09-21  Yao Qi  <yao.qi@linaro.org>

* ax.c [!IN_PROCESS_AGENT] (gdb_agent_op_sizes): Define it.

9 years ago[gdbserver] Remove unused max_jump_pad_size
Yao Qi [Mon, 21 Sep 2015 10:49:22 +0000 (11:49 +0100)]
[gdbserver] Remove unused max_jump_pad_size

This patch is to remove max_jump_pad_size which isn't used else where,
and it causes a recent gcc warning like this,

gdb/gdbserver/tracepoint.c:2920:18: error: 'max_jump_pad_size' defined but not used [-Werror=unused-const-variable]
 static const int max_jump_pad_size = 0x100;
                  ^
cc1: all warnings being treated as errors

This variable max_jump_pad_size wasn't used since it was added in 2010
by https://sourceware.org/ml/gdb-patches/2010-06/msg00002.html

gdb/gdbserver:

2015-09-21  Yao Qi  <yao.qi@linaro.org>

* tracepoint.c (max_jump_pad_size): Remove.

9 years agodwarf2read.c (add_partial_symbol): Remove outdated comments.
Doug Evans [Mon, 21 Sep 2015 04:48:31 +0000 (21:48 -0700)]
dwarf2read.c (add_partial_symbol): Remove outdated comments.

gdb/ChangeLog:

* dwarf2read.c (add_partial_symbol): Remove outdated comments.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agodwarf2_compute_name: add fixme, don't use same name as parameter for local
Doug Evans [Sun, 20 Sep 2015 21:13:54 +0000 (14:13 -0700)]
dwarf2_compute_name: add fixme, don't use same name as parameter for local

gdb/ChangeLog:

* dwarf2read.c (dwarf2_compute_name): Add FIXME.  Don't use a local
variable name that collides with a parameter.

9 years agocrash printing non-local variable from nested subprogram
Joel Brobecker [Tue, 1 Sep 2015 20:20:32 +0000 (22:20 +0200)]
crash printing non-local variable from nested subprogram

We have noticed that GDB would sometimes crash trying to print
from a nested function the value of a variable declared in an
enclosing scope. This appears to be target dependent, although
that correlation might only be fortuitious.  We noticed the issue
on x86_64-darwin, x86-vxworks6 and x86-solaris.  The investigation
was done on Darwin.

This is a new feature that was introduced by:

    commit 63e43d3aedb8b1112899c2d0ad74cbbee687e5d6
    Date:   Thu Feb 5 17:00:06 2015 +0100
    DWARF: handle non-local references in nested functions

We can reproduce the problem with one of the testcases that was
added with the patch (gdb.base/nested-subp1.exp), where we have...

    18 int
    19 foo (int i1)
    20 {
    21   int
    22   nested (int i2)
    23   {
    [...]
    27     return i1 * i2; /* STOP */
    28   }

...  After building the example program, and running until line 27,
try printing the value of "i1":

    % gdb gdb.base/nested-subp1
    (gdb) break foo.c:27
    (gdb) run
    Breakpoint 1, nested (i2=2) at /[...]/nested-subp1.c:27
    27          return i1 * i2; /* STOP */
    (gdb) p i1
    [1]    73090 segmentation fault  ../gdb -q gdb.base/nested-subp1

Ooops!

What happens is that, because the reference is non-local, we are trying
to follow the function's static link, which does...

    /* If we don't know how to compute FRAME's base address, don't give up:
       maybe the frame we are looking for is upper in the stace frame.  */
    if (framefunc != NULL
        && SYMBOL_BLOCK_OPS (framefunc)->get_frame_base != NULL
        && (SYMBOL_BLOCK_OPS (framefunc)->get_frame_base (framefunc, frame)
            == upper_frame_base))

... or, in other words, calls the get_frame_base "method" of
framefunc's struct symbol_block_ops data. This resolves to
the block_op_get_frame_base function.

Looking at the function's implementation, we see:

  struct dwarf2_locexpr_baton *dlbaton;
  [...]
  dlbaton = SYMBOL_LOCATION_BATON (framefunc);
  [...]
  result = dwarf2_evaluate_loc_desc (type, frame, start, length,
                                     dlbaton->per_cu);
                                     ^^^^^^^^^^^^^^^

Printing dlbaton->per_cu gives a value that seems fairly bogus for
a memory address (0x60). Because of it, dwarf2_evaluate_loc_desc
then crashes trying to dereference it.

What's different on Darwin compared to Linux is that the function's
frame base is encoded using the following form:

        .byte   0x40    # uleb128 0x40; (DW_AT_frame_base)
        .byte   0x6     # uleb128 0x6; (DW_FORM_data4)

... and so dwarf2_symbol_mark_computed ends up creating
a SYMBOL_LOCATION_BATON as a struct dwarf2_loclist_baton:

  if (attr_form_is_section_offset (attr)
      /* .debug_loc{,.dwo} may not exist at all, or the offset may be outside
         the section.  If so, fall through to the complaint in the
         other branch.  */
      && DW_UNSND (attr) < dwarf2_section_size (objfile, section))
    {
      struct dwarf2_loclist_baton *baton;
      [...]
      SYMBOL_LOCATION_BATON (sym) = baton;

However, if you look more closely at block_op_get_frame_base's
implementation, you'll notice that the function extracts the
symbol's SYMBOL_LOCATION_BATON as a dwarf2_locexpr_baton
(a DWARF _expression_ rather than a _location list_).
That's why we end up decoding the DLBATON improperly, and thus
pass a random dlbaton->per_cu when calling dwarf2_evaluate_loc_desc.

This works on x86_64-linux, because we indeed have the frame base
described using a different form:

        .uleb128 0x40   # (DW_AT_frame_base)
        .uleb128 0x18   # (DW_FORM_exprloc)

This patch fixes the issue by doing what we do for most (if not all)
other such methods: providing one implementation each for loc-list,
and loc-expr. Both implementations are nearly identical, so perhaps
we might later want to improve this. But this patch first tries to
fix the crash first, leaving the design issue for later.

gdb/ChangeLog:

        * dwarf2loc.c (locexpr_get_frame_base): Renames
        block_op_get_frame_base.
        (dwarf2_block_frame_base_locexpr_funcs): Replace reference to
        block_op_get_frame_base by reference to locexpr_get_frame_base.
        (loclist_get_frame_base): New function, near identical copy of
        locexpr_get_frame_base.
        (dwarf2_block_frame_base_loclist_funcs): Replace reference to
        block_op_get_frame_base by reference to loclist_get_frame_base.

Tested on x86_64-darwin (AdaCore testsuite), and x86_64-linux
(official testsuite).

9 years agoAdd --no-dynamic-linker option to ld, for static PIE use
Rich Felker [Sun, 20 Sep 2015 02:50:19 +0000 (12:20 +0930)]
Add --no-dynamic-linker option to ld, for static PIE use

Inhibits output of .interp section in ELF executables.

include/
* bfdlink.h (struct bfd_link_info): Add "nointerp" field.
bfd/
* elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
.interp when info->nointerp.
(bfd_elf_size_dynamic_sections): Adjust assert.
* elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp
when info->nointerp.
* elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
* elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
* elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
* elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
* elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise.
* elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
* elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
ld/
* ld.texinfo (--no-dynamic-linker): Document.
* ldlex.h (enum option_values): Add OPTION_NO_DYNAMIC_LINKER.
* lexsup.c (ld_options, parse_args): Handle --no-dynamic-linker.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Sep 2015 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoReplace current_inferior ()->gdbarch with its wrapper target_gdbarch.
Doug Evans [Sat, 19 Sep 2015 15:29:58 +0000 (08:29 -0700)]
Replace current_inferior ()->gdbarch with its wrapper target_gdbarch.

gdb/ChangeLog:

* ravenscar-thread.c (ravenscar_inferior_created): Replace
current_inferior ()->gdbarch with its wrapper target_gdbarch.

9 years agolinux-thread-db.c (record_thread): Return the created thread.
Doug Evans [Sat, 19 Sep 2015 06:21:04 +0000 (23:21 -0700)]
linux-thread-db.c (record_thread): Return the created thread.

gdb/ChangeLog:

* linux-thread-db.c (record_thread): Return the created thread.
(thread_from_lwp): Likewise.
(thread_db_get_thread_local_address): Update.

9 years agosymtab.h (general_symbol_info) <mangled_lang>: delete and move up only member.
Doug Evans [Sat, 19 Sep 2015 05:30:22 +0000 (22:30 -0700)]
symtab.h (general_symbol_info) <mangled_lang>: delete and move up only member.

gdb/ChangeLog:

* symtab.h (general_symbol_info) <mangled_lang>: Delete struct,
move only member demangled_name up.  All uses updated.

9 years agodefault_read_var_value <LOC_UNRESOLVED>: Include minsym kind in error message.
Doug Evans [Sat, 19 Sep 2015 04:43:38 +0000 (21:43 -0700)]
default_read_var_value <LOC_UNRESOLVED>: Include minsym kind in error message.

bfd/ChangeLog:

* targets.c (enum bfd_flavour): Add comment.
(bfd_flavour_name): New function.
* bfd-in2.h: Regenerate.

gdb/ChangeLog:

* findvar.c (default_read_var_value) <LOC_UNRESOLVED>: Include the
kind of minimal symbol in the error message.
* objfiles.c (objfile_flavour_name): New function.
* objfiles.h (objfile_flavour_name): Declare.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/dw2-bad-unresolved.c: New file.
* gdb.dwarf2/dw2-bad-unresolved.exp: New file.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix directory prefix in gdb.base/dso2dso.exp.
Sandra Loosemore [Fri, 18 Sep 2015 19:21:06 +0000 (12:21 -0700)]
Fix directory prefix in gdb.base/dso2dso.exp.

2015-09-18  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/dso2dso.exp: Don't use directory prefix when setting
the breakpoint.

9 years agoFix pathname prefix and timeout issues in gdb.mi/mi-pending.exp.
Sandra Loosemore [Fri, 18 Sep 2015 18:52:26 +0000 (11:52 -0700)]
Fix pathname prefix and timeout issues in gdb.mi/mi-pending.exp.

2015-09-18  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.mi/mi-pending.exp: Don't use directory prefix when setting
the pending breakpoint.  Remove timeout override for "Run till
MI pending breakpoint on pendfunc3 on thread 2" test.

9 years agoGeneralize breakpoint pattern in gdb.mi/mi-cli.exp.
Sandra Loosemore [Fri, 18 Sep 2015 16:39:31 +0000 (09:39 -0700)]
Generalize breakpoint pattern in gdb.mi/mi-cli.exp.

2015-09-18  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.mi/mi-cli.exp: Don't require directory prefix in breakpoint
filename pattern.

9 years agoGeneralize filename pattern in gdb.mi/mi-dprintf-pending.exp.
Sandra Loosemore [Fri, 18 Sep 2015 16:22:02 +0000 (09:22 -0700)]
Generalize filename pattern in gdb.mi/mi-dprintf-pending.exp.

2015-09-18  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.mi/mi-dprintf-pending.exp: Don't require directory prefix
in breakpoint filename pattern.

9 years agoFix shared library load in gdb.base/global-var-nested-by-dso.exp.
Sandra Loosemore [Fri, 18 Sep 2015 16:05:37 +0000 (09:05 -0700)]
Fix shared library load in gdb.base/global-var-nested-by-dso.exp.

2015-09-18  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/global-var-nested-by-dso.exp: Call gdb_load_shlibs.

9 years agoRequire readline for gdb.linespec/explicit.exp tab-completion tests.
Sandra Loosemore [Fri, 18 Sep 2015 15:54:20 +0000 (08:54 -0700)]
Require readline for gdb.linespec/explicit.exp tab-completion tests.

2015-09-18  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.linespec/explicit.exp: Check for readline support for
tab-completion tests.  Fix obvious typo.

9 years agoaarch64 multi-arch (part 3): get thread area
Yao Qi [Fri, 18 Sep 2015 12:59:42 +0000 (13:59 +0100)]
aarch64 multi-arch (part 3): get thread area

With the kernle fix <http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/356511.html>,
aarch64 GDB is able to read the base of thread area of 32-bit arm
program through NT_ARM_TLS.

This patch is to teach both GDB and GDBserver to read the base of
thread area correctly in the multi-arch case.  A new function
aarch64_ps_get_thread_area is added, and is shared between GDB and
GDBserver.

With this patch applied, the following fails in multi-arch testing
(GDB is aarch64 but the test cases are arm) are fixed,

 -FAIL: gdb.threads/tls-nodebug.exp: thread local storage
 -FAIL: gdb.threads/tls-shared.exp: print thread local storage variable
 -FAIL: gdb.threads/tls-so_extern.exp: print thread local storage variable
 -FAIL: gdb.threads/tls-var.exp: print tls_var
 -FAIL: gdb.threads/tls.exp: first thread local storage
 -FAIL: gdb.threads/tls.exp: first another thread local storage
 -FAIL: gdb.threads/tls.exp: p a_thread_local
 -FAIL: gdb.threads/tls.exp: p file2_thread_local
 -FAIL: gdb.threads/tls.exp: p a_thread_local second time

gdb:

2015-09-18  Yao Qi  <yao.qi@linaro.org>

* nat/aarch64-linux.c: Include elf/common.h,
nat/gdb_ptrace.h, asm/ptrace.h and sys/uio.h.
(aarch64_ps_get_thread_area): New function.
* nat/aarch64-linux.h: Include gdb_proc_service.h.
(aarch64_ps_get_thread_area): Declare.
* aarch64-linux-nat.c (ps_get_thread_area): Call
aarch64_ps_get_thread_area.

gdb/gdbserver:

2015-09-18  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c: Don't include sys/uio.h.
(ps_get_thread_area): Call aarch64_ps_get_thread_area.

9 years agobtrace: honour scheduler-locking for all-stop targets
Markus Metzger [Wed, 16 Sep 2015 07:05:22 +0000 (09:05 +0200)]
btrace: honour scheduler-locking for all-stop targets

In all-stop mode, record btrace maintains the old behaviour of an implicit
scheduler-locking on.

Now that we added a scheduler-locking mode to model this old behaviour, we
don't need the respective code in record btrace anymore.  Remove it.

For all-stop targets, step inferior_ptid and continue other threads matching
the argument ptid.  Assert that inferior_ptid matches the argument ptid.

This should make record btrace honour scheduler-locking.

gdb/
* record-btrace.c (record_btrace_resume): Honour scheduler-locking.

testsuite/
* gdb.btrace/multi-thread-step.exp: Test scheduler-locking on, step,
and replay.

9 years agoinfrun: scheduler-locking replay
Markus Metzger [Mon, 7 Sep 2015 13:41:00 +0000 (15:41 +0200)]
infrun: scheduler-locking replay

Record targets behave as if scheduler-locking were on in replay mode.  Add a
new scheduler-locking option "replay" to make this implicit behaviour explicit.
It behaves like "on" in replay mode and like "off" in record mode.

By making the current behaviour a scheduler-locking option, we allow the user
to change it.  Since it is the current behaviour, this new option is also
the new default.

One caveat is that when resuming a thread that is at the end of its execution
history, record btrace implicitly stops replaying other threads and resumes
the entire process.  This is a convenience feature to not require the user
to explicitly move all other threads to the end of their execution histories
before being able to resume the process.

We mimick this behaviour with scheduler-locking replay and move it from
record-btrace into infrun.  With all-stop on top of non-stop, we can't do
this in record-btrace anymore.

Record full does not really support multi-threading and is therefore not
impacted.  If it were extended to support multi-threading, it would 'benefit'
from this change.  The good thing is that all record targets will behave the
same with respect to scheduler-locking.

I put the code for this into clear_proceed_status.  It also sends the
about_to_proceed notification.

gdb/
* NEWS: Announce new scheduler-locking mode.
* infrun.c (schedlock_replay): New.
(scheduler_enums): Add schedlock_replay.
(scheduler_mode): Change default to schedlock_replay.
(user_visible_resume_ptid): Handle schedlock_replay.
(clear_proceed_status_thread): Stop replaying if resumed thread is
not replaying.
(schedlock_applies): Handle schedlock_replay.
(_initialize_infrun): Document new scheduler-locking mode.
* record-btrace.c (record_btrace_resume): Remove code to stop other
threads when not replaying the resumed thread.

doc/
* gdb.texinfo (All-Stop Mode): Describe new scheduler-locking mode.

9 years agotarget: add to_record_will_replay target method
Markus Metzger [Thu, 17 Sep 2015 09:14:55 +0000 (11:14 +0200)]
target: add to_record_will_replay target method

Add a new target method to_record_will_replay to query if there is a record
target that will replay at least one thread matching the argument PTID if it
were executed in the argument execution direction.

gdb/
* record-btrace.c ((record_btrace_will_replay): New.
(init_record_btrace_ops): Initialize to_record_will_replay.
* record-full.c ((record_full_will_replay): New.
(init_record_full_ops): Initialize to_record_will_replay.
* target-delegates.c: Regenerated.
* target.c (target_record_will_replay): New.
* target.h (struct target_ops) <to_record_will_replay>: New.
(target_record_will_replay): New.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
9 years agotarget: add to_record_stop_replaying target method
Markus Metzger [Tue, 8 Sep 2015 07:42:20 +0000 (09:42 +0200)]
target: add to_record_stop_replaying target method

Add a new target method to_record_stop_replaying to stop replaying.

gdb/
* record-btrace.c (record_btrace_resume): Call
target_record_stop_replaying.
(record_btrace_stop_replaying_all): New.
(init_record_btrace_ops): Initialize to_record_stop_replaying.
* record-full.c (record_full_stop_replaying): New.
(init_record_full_ops ): Initialize to_record_stop_replaying.
* target-delegates.c: Regenerated.
* target.c (target_record_stop_replaying): New.
* target.h (struct target_ops) <to_record_stop_replaying>: New.
(target_record_stop_replaying): New.

9 years agobtrace: allow full memory and register access for non-replaying threads
Markus Metzger [Tue, 8 Sep 2015 07:05:38 +0000 (09:05 +0200)]
btrace: allow full memory and register access for non-replaying threads

The record btrace target does not allow accessing memory and storing registers
while replaying.  For multi-threaded applications, this prevents those
accesses also for threads that are at the end of their execution history as
long as at least one thread is replaying.

Change this to only check if the selected thread is replaying.  This allows
threads that are at the end of their execution history to read and write
memory and to store registers.

Also change the error message to reflect this change.

gdb/
* record-btrace.c (record_btrace_xfer_partial)
(record_btrace_store_registers, record_btrace_prepare_to_store):
Call record_btrace_is_replaying with inferior_ptid instead of
minus_one_ptid.
(record_btrace_store_registers): Change error message.