Sanimir Agovic [Wed, 5 Feb 2014 16:22:08 +0000 (16:22 +0000)]
vla: evaluate operand of sizeof if its type is a vla
The c99 standard in "6.5.3.4 The sizeof operator" states:
If the type of the operand is a variable length array type, the operand
is evaluated;[...]
This patch mirrors the following c99 semantic in gdb:
1| int vla[n][m];
2| int i = 1;
3| sizeof(vla[i++][0]); // No sideffect
4| assert (i == 1);
5| sizeof(vla[i++]); // With sideffect
6| assert (i == 2);
Note: ptype/whatsis still do not allow any sideeffects.
This patch was motivated by:
https://sourceware.org/ml/gdb-patches/2014-01/msg00732.html
* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.
testsuite/gdb.base/
* vla-sideeffect.c: New file.
* vla-sideeffect.exp: New file.
Sanimir Agovic [Tue, 26 Nov 2013 14:35:43 +0000 (14:35 +0000)]
vla: resolve dynamic bounds if value contents is a constant byte-sequence
A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.
* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.
Sanimir Agovic [Tue, 19 Nov 2013 12:54:24 +0000 (12:54 +0000)]
vla: support for DW_AT_count
This patch adds support for DW_AT_count as requested in the code review:
https://sourceware.org/ml/gdb-patches/2013-11/msg00200.html
* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.
Sanimir Agovic [Thu, 14 Nov 2013 09:55:52 +0000 (09:55 +0000)]
vla: print "variable length" for unresolved dynamic bounds
1| void foo (size_t n) {
2| int vla[n];
3| }
Given the following expression
(gdb) ptype &vla
Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:
type = int (*)[
1289346]
this patch deals with this case and prints:
type = int (*)[variable length]
instead.
* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.
Sanimir Agovic [Mon, 14 Oct 2013 07:36:13 +0000 (08:36 +0100)]
vla: update type from newly created value
Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.
* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* eval.c (evaluate_subexp_with_coercion): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.
Sanimir Agovic [Sat, 12 Oct 2013 11:36:16 +0000 (12:36 +0100)]
vla: enable sizeof operator for indirection
This patch enables the sizeof operator for indirections:
1| void foo (size_t n) {
2| int vla[n];
3| int *vla_ptr = &vla;
4| }
(gdb) p sizeof(*vla_ptr)
yields sizeof (size_t) * n.
* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
vla: enable sizeof operator to work with variable length arrays
In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.
We now are able to get the size of a vla:
1| void foo (size_t n) {
2| int vla[n];
3| }
(gdb) p sizeof(vla)
yields N * sizeof(int).
* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
type: add c99 variable length array support
The dwarf standard allow certain attributes to be expressed as dwarf
expressions rather than constants. For instance upper-/lowerbound attributes.
In case of a c99 variable length array the upperbound is a dynamic attribute.
With this change c99 vla behave the same as with static arrays.
1| void foo (size_t n) {
2| int ary[n];
3| memset(ary, 0, sizeof(ary));
4| }
(gdb) print ary
$1 = {0 <repeats 42 times>}
* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.
Sanimir Agovic [Tue, 8 Oct 2013 14:04:49 +0000 (15:04 +0100)]
vla: introduce new bound type abstraction adapt uses
The rational behind this patch is to get started to implement the feature
described in dwarf4 standard (2.19) Static and Dynamic Values of Attributes.
It adds new BOUND_PROP to store either a constant, exprloc, or reference to
describe an upper-/lower bound of a subrange. Other than that no new features
are introduced.
* dwarf2read.c (read_subrange_type): Use struct bound_prop for
declaring high/low bounds and change uses accordingly. Call
create_range_type instead of create_static_range_type.
* gdbtypes.c (create_range_type): New function.
(create_range_type): Convert bounds into struct bound_prop and pass
them to create_range_type.
* gdbtypes.h (struct bound_prop): New struct.
(create_range_type): New function prototype.
(struct range_bounds): Use struct bound_prop instead of LONGEST for
high/low bounds. Remove low_undefined/high_undefined and adapt all uses.
(TYPE_LOW_BOUND,TYPE_HIGH_BOUND): Adapt macros to refer to the static
part of the bound.
* parse.c (follow_types): Set high bound kind to BOUND_UNDEFINED.
Sanimir Agovic [Thu, 19 Dec 2013 08:31:17 +0000 (08:31 +0000)]
refactoring: rename create_range_type to create_static_range_type
* gdbtypes.c (create_static_range_type): Renamed from create_range_type.
* gdbtypes.h (create_static_range_type): Renamed from create_range_type.
* ada-lang.c: All uses of create_range_type updated.
* coffread.c: All uses of create_range_type updated.
* dwarf2read.c: All uses of create_range_type updated.
* f-exp.y: All uses of create_range_type updated.
* m2-valprint.c: All uses of create_range_type updated.
* mdebugread.c: All uses of create_range_type updated.
* stabsread.c: All uses of create_range_type updated.
* valops.c: All uses of create_range_type updated.
* valprint.c: All uses of create_range_type updated.
Nick Clifton [Fri, 11 Apr 2014 11:39:03 +0000 (12:39 +0100)]
Regenerate header files after this commit:
2014-04-10 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations
Yao Qi [Wed, 2 Apr 2014 04:44:22 +0000 (12:44 +0800)]
Check file exists before completion tests
Doug told me that there are some regressions in gdb.base/completion.exp.
They are caused by my recent change, and can be reproduced via:
$ make check-parallel TESTS=gdb.base/completion.exp
FAIL: gdb.base/completion.exp: complete target core ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target tfile ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target exec ./gdb.base/completion
Current tests assume that gdb.base/completion exists but that is wrong
in a parallel run, because binary file and object files are placed
in outputs/gdb.base/completion/.
This patch is to check file exists on two candidate directories,
"gdb.base" and "outputs/gdb.base/completion/", and run tests with files
existed in either of them.
gdb/testsuite:
2014-04-11 Yao Qi <yao@codesourcery.com>
* gdb.base/completion.exp: Check file exists before running tests
on file completion.
Sandra Loosemore [Fri, 11 Apr 2014 00:14:18 +0000 (17:14 -0700)]
Ignore non-stub sections for nios2 stub_bfd processing.
2014-04-10 Cesar Philippidis <cesar@codesourcery.com>
bfd/
* elf32-nios2.c (nios2_elf32_build_stubs): Ignore dynobjs
when building function stubs.
Alan Modra [Fri, 11 Apr 2014 00:00:57 +0000 (09:30 +0930)]
daily update
Pedro Alves [Thu, 10 Apr 2014 18:22:23 +0000 (19:22 +0100)]
Conditional Z1 breakpoint hangs GDBserver.
While trying to fix hbreak2.exp against GDBserver I noticed this...
(gdb) hbreak main if 1
Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000
Sending packet: $m40058f,1#31...Packet received: c7
Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46.
Sending packet: $Z1,40058f,1;X3,220127#9b...
*hangs forever*
The issue is that nothing advances the packet pointer if
add_breakpoint_condition either fails to parse the agent expression,
or fails to find the breakpoint, resulting in an infinite loop in
process_point_options. The latter case should really be fixed by
GDBserver tracking GDB Z1 breakpoints in its breakpoint structures
like Z0 breakpoints are, but the latter case still needs handling.
add_breakpoint_commands has the same issue, though at present I don't
know any way to trigger it other than sending a manually cooked
packet.
Unbelievably, it doesn't look like we have any test that tries setting
a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it
looks like the file was meant to actually test something, but it's
mostly empty today. This patch adds tests that tries all sorts of
conditional breakpoints and watchpoints. The test hangs/fails without
the GDBserver fix.
Tested on x86_64 Fedora 17.
gdb/gdbserver/
2014-04-10 Pedro Alves <palves@redhat.com>
* mem-break.c (add_breakpoint_condition, add_breakpoint_commands):
Check if the condition or command is NULL before checking if the
breakpoint is known. On success, return true.
* mem-break.h (add_breakpoint_condition): Document return.
(add_breakpoint_commands): Add describing comment.
* server.c (skip_to_semicolon): New function.
(process_point_options): Use it.
gdb/testsuite/
2014-04-10 Pedro Alves <palves@redhat.com>
* gdb.base/cond-eval-mode.c: New file.
* gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust
prepare_for_testing to build the new file. Check result of
runto_main.
(test_break, test_watch): New procedures.
(top level): Use them.
Denis Chertykov [Thu, 10 Apr 2014 15:50:33 +0000 (19:50 +0400)]
bfd/ChangeLog
* elf32-avr.c: Add DIFF relocations for AVR.
(avr_final_link_relocate): Handle the DIFF relocs.
(bfd_elf_avr_diff_reloc): New.
(elf32_avr_is_diff_reloc): New.
(elf32_avr_adjust_diff_reloc_value): Reduce difference value.
(elf32_avr_relax_delete_bytes): Recompute difference after deleting
bytes.
* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations
gas/ChangeLog
* config/tc-avr.c: Add new flag mlink-relax.
(md_show_usage): Add flag and help text.
(md_parse_option): Record whether link relax is turned on.
(relaxable_section): New.
(avr_validate_fix_sub): New.
(avr_force_relocation): New.
(md_apply_fix): Generate DIFF reloc.
(avr_allow_local_subtract): New.
* config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0.
(TC_FORCE_RELOCATION): Define.
(TC_FORCE_RELOCATION_SUB_SAME): Define.
(TC_VALIDATE_FIX_SUB): Define.
(avr_force_relocation): Declare.
(avr_validate_fix_sub): Declare.
(md_allow_local_subtract): Define.
(avr_allow_local_subtract): Declare.
gas/testsuite/ChangeLog
* gas/avr/diffreloc_withrelax.d: New testcase.
* gas/avr/noreloc_withoutrelax.d: Likewise.
* gas/avr/relax.s: Likewise.
include/ChangeLog
* elf/avr.h: Add new DIFF relocs.
ld/testsuite/ChangeLog
* ld-avr/norelax_diff.d: New testcase.
* ld-avr/relax_diff.d: Likewise.
* ld-avr/relax.s: Likewise.
Pedro Alves [Thu, 10 Apr 2014 13:19:52 +0000 (14:19 +0100)]
breakpoint shadowing, take single-step breakpoints into account.
Breakpoints are supposed to be transparent to memory accesses. For
all kinds of breakpoints breakpoint_xfer_memory hides the breakpoint
instructions. However, sss breakpoints aren't tracked like all other
breakpoints, and nothing is taking care of hiding them from memory
reads.
Say, as is, a background step + disassemble will see breakpoints
instructions on software step targets. E.g., stepping over this line:
while (1);
with s&
and then "disassemble" would show sss breakpoints.
Actually, that's still not be possible to see today, because:
- in native Linux, you can't read memory while the program
is running.
- with Linux gdbserver, you can, but in the all-stop RSP you
can't talk to the server while the program is running...
- and with non-stop, on software step targets, we presently
force the use of displaced-stepping for all single-steps,
so no single-step breakpoints are used...
I've been working towards making non-stop not force displaced stepping
on sss targets, and I noticed the issue then. With that, I indeed see
this:
(gdb) set remote Z-packet off
(gdb) s&
(gdb) disassemble main
Dump of assembler code for function main:
0x000000000040049c <+0>: push %rbp
0x000000000040049d <+1>: mov %rsp,%rbp
0x00000000004004a0 <+4>: int3
0x00000000004004a1 <+5>: (bad)
End of assembler dump.
Instead of the correct:
(gdb) disassemble main
Dump of assembler code for function main:
0x000000000040049c <+0>: push %rbp
0x000000000040049d <+1>: mov %rsp,%rbp
0x00000000004004a0 <+4>: jmp 0x4004a0 <main+4>
This is actually one thing that my v1 of the recent "fix a bunch of
run control bugs" series was fixing, because it made sss breakpoints
be regular breakpoints in the breakpoint chain. But dropped it in the
version that landed in the tree, due to some problems.
So instead of making sss breakpoints regular breakpoints, go with a
simpler fix (at least for now) -- make breakpoint_xfer_memory take
software single-step breakpoints into account. After the patch, I get
the correct disassemble output.
Tested on x86_64 Fedora 17, and also on top of my "use software
single-step on x86" series.
Also fixes the issue pointed out by Yao at
https://sourceware.org/ml/gdb-patches/2014-04/msg00045.html, where the
prologue analysis/frame sniffing manages to see software step
breakpoint instructions.
gdb/
2014-04-10 Pedro Alves <palves@redhat.com>
* breakpoint.c (single_step_breakpoints)
(single_step_gdbarch): Move up in the file.
(one_breakpoint_xfer_memory): New function, factored out from ...
(breakpoint_xfer_memory): ... here. Also process single-step
breakpoints.
Andrew Bennett [Tue, 8 Apr 2014 13:50:42 +0000 (14:50 +0100)]
Add support for the MIPS P5600 family of CPUs.
ChangeLog:
2014-04-10 Andrew Bennett <andrew.bennett@imgtec.com>
* config/tc-mips.c (mips_cpu_info_table): Add P5600
configuation.
* doc/c-mips.texi: Document p5600.
Alan Modra [Thu, 10 Apr 2014 00:00:52 +0000 (09:30 +0930)]
daily update
Nick Clifton [Wed, 9 Apr 2014 16:12:30 +0000 (17:12 +0100)]
Remove remaining default manifest support.
* Makefile.am (default-manifest.o): Remove rule.
(EMUL_EXTRA_BINARIES): Delete.
(ALL_EMUL_EXTRA_BINARIES): Delete.
(ld_new_DEPENDENCIES): Remove EMUL_EXTRA_BINARIES.
(install-data-local): Remove EMUL_EXTRA_BINARIES.
* Makefile.in: Regenerate.
* configure.in (all_emul_extra_binaries): Delete.
(EMUL_EXTRA_BINARIES): Remove.
* configure: Regenerate.
* configure.tgt (target_extra_binaries): Delete.
* emultempl/default-manifest.rc: Delete.
* ld.texinfo: Remove discussion of default manifest.
* emulparams/i386pe.sh (DEFAULT_MANIFEST): Delete.
* emulparams/i386pep.sh (DEFAULT_MANIFEST): Delete.
Pedro Alves [Wed, 9 Apr 2014 14:01:33 +0000 (15:01 +0100)]
[GDBserver] Fix SH/Linux build.
sh-linux-gnu-gcc (...) src/gdb/gdbserver/linux-low.c
.../src/gdb/gdbserver/linux-low.c: In function 'linux_read_loadmap':
.../src/gdb/gdbserver/linux-low.c:5284:13: error: 'struct lwp_info' has no member named 'entry'
make[1]: *** [linux-low.o] Error 1
gdb/gdbserver/
2014-04-09 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_read_loadmap): Pass current_inferior directly
to lwpid_of.
Nick Clifton [Wed, 9 Apr 2014 13:05:58 +0000 (14:05 +0100)]
Fix a few more targets affected by the change to the TC_CONS_FIX_NEW macro.
* config/tc-rl78.h (TC_CONS_FIX_NEW): Add RELOC parameter.
* config/tc-z80.h (TC_CONS_FIX_NEW): Discard RELOC parameter.
* config/tc-aarch64.h (TC_CONS_FIX_NEW): Discard RELOC parameter.
* read.c (emit_expr_fix): Mark the r parameter as potentially
unused.
Tristan Gingold [Wed, 9 Apr 2014 08:23:19 +0000 (10:23 +0200)]
darwin: fix thinko (free thread port after threads are discovered).
Due to a thinko, a message could be not understood and ignored. The result
was a dead-lock (gdb is waiting for an event that never happen). The port
of the thread was deallocated before new threads are discovered. As a
consequence, the origin of the message was unknown (instead of being
linked to the newly created thread).
gdb/
* darwin-nat.c (darwin_check_new_threads): Fix port leak, add
comments.
(darwin_decode_exception_message): Free port only after use.
Alan Modra [Wed, 9 Apr 2014 03:53:41 +0000 (13:23 +0930)]
Add a time-stamp for chew
One last time-stamp. Now none of the doc rules using move-if-change
will run unnecessarily.
* Makefile.am ($(MKDOC)): New rule, depend on chew.stamp. Move
old rule to..
(chew.stamp): ..here.
(DISTCLEANFILES): Move *.stamp..
(MOSTLYCLEANFILES): ..to here.
* Makefile.in: Regenerate.
Alan Modra [Tue, 8 Apr 2014 21:33:53 +0000 (07:03 +0930)]
ppc476 gas warn on data in code sections
* config/tc-ppc.c (warn_476, last_insn, last_seg, last_subseg):
New static vars.
(md_longopts, md_parse_option, md_show_usage): Add --ppc476-workaround.
(ppc_elf_cons_fix_check): New function.
(md_assemble): Set last_insn, last_seg, last_subseg.
(ppc_byte, md_apply_fix): Handle warn_476.
* config/tc-ppc.h (TC_CONS_FIX_CHECK): Define.
(ppc_elf_cons_fix_check): Declare.
* read.c (cons_worker): Invoke TC_CONS_FIX_CHECK.
Alan Modra [Tue, 8 Apr 2014 05:08:22 +0000 (14:38 +0930)]
gas TC_PARSE_CONS_EXPRESSION communication with TC_CONS_FIX_NEW
A number of targets pass extra information from TC_PARSE_CONS_EXPRESSION
to TC_CONS_FIX_NEW via static variables. That's OK, but not best
practice. tc-ppc.c goes further in implementing its own replacement
for cons(), because the generic one doesn't allow relocation modifiers
on constants. This patch fixes both of these warts.
* gas/config/tc-alpha.h (TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arc.c (arc_cons_fix_new): Add reloc parameter.
* gas/config/tc-arc.h (arc_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arm.c (cons_fix_new_arm): Similarly
* gas/config/tc-arm.h (cons_fix_new_arm, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-cr16.c (cr16_cons_fix_new): Similarly.
* gas/config/tc-cr16.h (cr16_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-crx.h (TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-m32c.c (m32c_cons_fix_new): Similarly.
* gas/config/tc-m32c.h (m32c_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-mn10300.c (mn10300_cons_fix_new): Similarly.
* gas/config/tc-mn10300.h (mn10300_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-ns32k.c (cons_fix_new_ns32k): Similarly.
* gas/config/tc-ns32k.h (cons_fix_new_ns32k): Similarly.
* gas/config/tc-pj.c (pj_cons_fix_new_pj): Similarly.
* gas/config/tc-pj.h (pj_cons_fix_new_pj, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-rx.c (rx_cons_fix_new): Similarly.
* gas/config/tc-rx.h (rx_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-sh.c (sh_cons_fix_new): Similarly.
* gas/config/tc-sh.h (sh_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-tic54x.c (tic54x_cons_fix_new): Similarly.
* gas/config/tc-tic54x.h (tic54x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-tic6x.c (tic6x_cons_fix_new): Similarly.
* gas/config/tc-tic6x.h (tic6x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-arc.c (arc_parse_cons_expression): Return reloc.
* gas/config/tc-arc.h (arc_parse_cons_expression): Update proto.
* gas/config/tc-avr.c (exp_mod_data): Make global.
(pexp_mod_data): Delete.
(avr_parse_cons_expression): Return exp_mod_data pointer.
(avr_cons_fix_new): Add exp_mod_data_t pointer param.
(exp_mod_data_t): Move typedef..
* gas/config/tc-avr.h: ..to here.
(exp_mod_data): Declare.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
(avr_parse_cons_expression, avr_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Update.
* gas/config/tc-hppa.c (hppa_field_selector): Delete static var.
(cons_fix_new_hppa): Add hppa_field_selector param.
(fix_new_hppa): Adjust.
(parse_cons_expression_hppa): Return field selector.
* gas/config/tc-hppa.h (parse_cons_expression_hppa): Update proto.
(cons_fix_new_hppa): Likewise.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
* gas/config/tc-i386.c (got_reloc): Delete static var.
(x86_cons_fix_new): Add reloc param.
(x86_cons): Return got reloc.
* gas/config/tc-i386.h (x86_cons, x86_cons_fix_new): Update proto.
(TC_CONS_FIX_NEW): Add RELOC param.
* gas/config/tc-ia64.c (ia64_cons_fix_new): Add reloc param. Adjust
calls.
* gas/config/tc-ia64.h (ia64_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add reloc param.
* gas/config/tc-microblaze.c (parse_cons_expression_microblaze):
Return reloc.
(cons_fix_new_microblaze): Add reloc param.
* gas/config/tc-microblaze.h: Formatting.
(parse_cons_expression_microblaze): Update proto.
(cons_fix_new_microblaze): Likewise.
* gas/config/tc-nios2.c (nios2_tls_ldo_reloc): Delete static var.
(nios2_cons): Return ldo reloc.
(nios2_cons_fix_new): Delete.
* gas/config/tc-nios2.h (nios2_cons): Update prototype.
(nios2_cons_fix_new, TC_CONS_FIX_NEW): Delete.
* gas/config/tc-ppc.c (md_pseudo_table): Remove quad, long, word,
short. Make llong use cons.
(ppc_elf_suffix): Return BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(ppc_elf_cons): Delete.
(ppc_elf_parse_cons): New function.
(ppc_elf_validate_fix): Don't check for BFD_RELOC_UNUSED.
(md_assemble): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
* gas/config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): Define
(ppc_elf_parse_cons): Declare.
* gas/config/tc-sparc.c (sparc_cons_special_reloc): Delete static var.
(sparc_cons): Return reloc specifier.
(cons_fix_new_sparc): Add reloc specifier param.
(sparc_cfi_emit_pcrel_expr): Use emit_expr_with_reloc.
* gas/config/tc-sparc.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(sparc_cons, cons_fix_new_sparc): Update prototype.
* gas/config/tc-v850.c (hold_cons_reloc): Delete static var.
(v850_reloc_prefix): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(md_assemble): Likewise.
(parse_cons_expression_v850): Return reloc.
(cons_fix_new_v850): Add reloc parameter.
* gas/config/tc-v850.h (parse_cons_expression_v850): Update proto.
(cons_fix_new_v850): Likewise.
* gas/config/tc-vax.c (vax_cons_special_reloc): Delete static var.
(vax_cons): Return reloc.
(vax_cons_fix_new): Add reloc parameter.
* gas/config/tc-vax.h (vax_cons, vax_cons_fix_new): Update proto.
* gas/config/tc-xstormy16.c (xstormy16_cons_fix_new): Add reloc param.
* gas/config/tc-xstormy16.h (xstormy16_cons_fix_new): Update proto.
* gas/dwarf2dbg.c (TC_PARSE_CONS_RETURN_NONE): Provide default.
(emit_fixed_inc_line_addr): Adjust exmit_expr_fix calls.
* gas/read.c (TC_PARSE_CONS_EXPRESSION): Return value.
(do_parse_cons_expression): Adjust.
(cons_worker): Pass return value from TC_PARSE_CONS_EXPRESSION
to emit_expr_with_reloc.
(emit_expr_with_reloc): New function handling reloc, mostly
extracted from..
(emit_expr): ..here.
(emit_expr_fix): Add reloc param. Adjust TC_CONS_FIX_NEW invocation.
Handle reloc.
(parse_mri_cons): Convert to ISO.
* gas/read.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(emit_expr_with_reloc): Declare.
(emit_expr_fix): Update prototype.
* gas/write.c (write_object_file): Update TC_CONS_FIX_NEW invocation.
Alan Modra [Wed, 9 Apr 2014 03:55:04 +0000 (13:25 +0930)]
Fix fallout from splitting ldbuildid.[ch] off elf32.em.
bfd/
* libcoff.h: Regenerate.
ld/
* emultempl/spuelf.em: Include safe-ctype.h, remove duplicate errno.h.
* emultempl/nds32elf.em: Include bfd_stdint.h.
* po/POTFILES.in: Regenerate.
Alan Modra [Tue, 8 Apr 2014 00:34:18 +0000 (10:04 +0930)]
bfd doc chew
I got tired of watching chew.c being compiled a dozen or more times
each time I do a binutils build.
* Makefile.am (MKDOC): Use $@ in command.
(aoutx.texi): New rule, depend on aoutx.stamp. Move old rule..
(aoutx.stamp): .. to here. Don't depend on chew.c, depend on MKDOC
and omit recursive MAKE. Use $< in command.
(archive.texi, archures.texi, bfdt.texi, cache.texi, coffcode.texi,
core.texi, elf.texi, elfcode.texi, mmo.texi, format.texi, libbfd.texi,
bfdio.texi, bfdwin.texi, opncls.texi, reloc.texi, section.texi,
syms.texi, targets.texi, init.texi, hash.texi, linker.texi): Similarly.
(DISTCLEANFILES): Remove *.stamp.
* Makefile.in: Regenerate.
Alan Modra [Wed, 9 Apr 2014 00:00:57 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 5 Apr 2014 07:25:13 +0000 (17:55 +1030)]
ppc476 icache workaround fix for bctr
I got the ppc476 workaround wrong. bctr (and bctrl) as the last
instruction in a page can hit the icache bug if the preceding mtctr
insn is close by, and the destination is in the first few instructions
on the next page. This scenario can occur with code generated by gcc
to implement switch statements, or in code generated to call by
function pointer.
To prevent the bctr problem it is also necessary to remove other
instructions that otherwise would be safe.
bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Remove bctr from list
of safe ppc476 insns at end of page. Also remove non-branch insns.
Expand comments.
ld/
* emultempl/ppc32elf.em (no_zero_padding, ppc_finish): New functions.
(LDEMUL_FINISH): Define.
Pierre Langlois [Fri, 4 Apr 2014 17:31:36 +0000 (18:31 +0100)]
Fix erroneous backtrace on avrxmega architectures.
* avr-tdep.c (struct gdbarch_tdep): Mention avrxmega in the comment.
(avr_gdbarch_init): Add xmega architectures given by bfd_architecture
when setting the size of call_length.
Nick Clifton [Tue, 8 Apr 2014 16:45:33 +0000 (17:45 +0100)]
This patch removes the inclusion of the default manifest in final links for
the Cygwin and MinGW targets. The manifest is now going to be handled by gcc.
* scripttempl/pe.sc (R_RSRC): Remove default manifest.
* scripttempl/pep.sc (R_RSRC): Remove default manifest.
Jon TURNEY [Tue, 8 Apr 2014 09:59:43 +0000 (10:59 +0100)]
Add support for generating and inserting build IDs into COFF binaries.
* peXXigen.c (pe_print_debugdata): New function: Displays the
contents of the debug directory and decodes codeview entries.
(_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
Add functions for reading and writing debugdir and codeview
records.
* libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
(_bfd_XXi_write_codeview_record): Add prototypes and macros.
* libcoff-in.h (pe_tdata): Add build-id data.
* libcoff.h: Regenerate.
* coffcode.h (coff_write_object_contents): Run build_id
after_write_object_contents hook.
* pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70)
(_CV_INFO_PDB20): Add structures and constants for debug directory
and codeview records.
* internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO):
Add structures and constants for internal representation of debug
directory and codeview records.
* emultempl/elf32.em (id_note_section_size, read_hex, write_build_id):
Move code for parsing build-id option and calculating the build-id to...
* ldbuildid.c: New file.
* ldbuildid.h: New file.
* Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new
files.
* Makefile.in: Regenerate.
* ld.texinfo: Update --build-id description to mention COFF
support.
* NEWS: Mention support for COFF build ids.
* emultempl/pe.em (gld${EMULATION_NAME}_handle_option):
(pecoff_checksum_contents, write_build_id, setup_build_id)
(gld_${EMULATION_NAME}_after_open): Handle and implement
build-id option.
* emultempl/pep.em: Likewise.
Pierre Muller [Tue, 25 Mar 2014 00:37:36 +0000 (08:37 +0800)]
[testsuite] Disable Ctrl-V use for mingw hosts.
On mingw host, we have seen two fails as below,
p int1dim[0]^V@2
Invalid character '^V' in expression.
(gdb) FAIL: gdb.base/printcmds.exp: p int1dim[0]@2
p int1dim[0]^V@2^V@3
Invalid character '^V' in expression.
(gdb) FAIL: gdb.base/printcmds.exp: p int1dim[0]@2@3
In the test, the comment says "# Send \026@ instead of just @ in case
the kill character is @". Historically, kill character was @, and
Ctrl-V (\026) is to escape the next character. However, we don't have
to do so on mingw. This patch is to disable ctrl-v usage on mingw
hots. With this patch applied, it becomes:
p int1dim[0]@2
$607 = {0, 1}
(gdb) PASS: gdb.base/printcmds.exp: p int1dim[0]@2
p int1dim[0]@2@3
$608 = {{0, 1}, {2, 3}, {4, 5}}
Note that this patch is picked from Pierre's submission,
[RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
https://www.sourceware.org/ml/gdb-patches/2013-09/msg00943.html
gdb/testsuite:
2014-04-08 Pierre Muller <muller@sourceware.org>
* gdb.base/printcmds.exp (test_artificial_arrays): Disable
Ctrl-V use for mingw hosts.
Alan Modra [Tue, 8 Apr 2014 00:00:58 +0000 (09:30 +0930)]
daily update
Siva Chandra [Fri, 21 Mar 2014 13:42:50 +0000 (06:42 -0700)]
[python] Fix gdb.Value.dynamic_type for reference values.
gdb.Value.dynamic_type is supposed to work for reference and pointer
values. However, the value object in the function 'valpy_get_dynamic_type'
was being dereferenced using 'value_ind' irrespective of the value type
being TYPE_CODE_PTR or TYPE_CODE_REF. This patch fixes that to use
'coerce_ref' for TYPE_CODE_REF values.
ChangeLog:
* python/py-value.c (valpy_get_dynamic_type): Use coerce_ref to
dereference TYPE_CODE_REF values.
testsuite/
* gdb.python/py-value.c: Improve test case.
* gdb.python/py-value.exp: Add new test.
Doug Evans [Mon, 7 Apr 2014 21:14:03 +0000 (14:14 -0700)]
Add support to recognize clang.
* lib/compiler.c: Identify the clang compiler.
* lib/compiler.cc: Ditto.
Andreas Schwab [Sat, 5 Apr 2014 20:03:44 +0000 (22:03 +0200)]
Fix spurious failures in ld-plugin/lto.exp
* ld-plugin/lto.exp: Make "-Wp," prefix optional when filtering
out _FORTIFY_SOURCE.
("Build libdummy.a 9", "PR ld/12696"): Mark as c++.
Joel Brobecker [Mon, 7 Apr 2014 16:43:23 +0000 (09:43 -0700)]
Fix ARI warning in darwin-nat.c::darwin_decode_message
gdb/ChangeLog:
* darwin-nat.c (darwin_decode_message): Remove trailing '\n' at
end of warning message.
Alan Modra [Mon, 7 Apr 2014 04:14:50 +0000 (13:44 +0930)]
Report an error on objcopy/strip of sectionless binaries
All strip operations require section headers to be present, as do most
objcopy operations. BFD is seriously confused by objects without
section info. The error message added here is similar to the error
on attempting to strip/objcopy a zero length object.
PR binutils/16811
* objcopy.c (copy_object): Error if no sections.
Alan Modra [Mon, 7 Apr 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 6 Apr 2014 00:00:52 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 5 Apr 2014 02:08:47 +0000 (12:38 +1030)]
Fix map file reference
The testcase in pr16417 comment #6 produces a map file showing
libpthread.so.0 (write@@GLIBC_2.2.5)
ie. missing the file referencing the symbol.
* elflink.c (_bfd_elf_add_default_symbol): Pass poldbfd when
merging non-default sym.
Alan Modra [Fri, 4 Apr 2014 23:00:58 +0000 (09:30 +1030)]
daily update
Eric Botcazou [Fri, 4 Apr 2014 20:54:42 +0000 (22:54 +0200)]
This fixes PR bootstrap/60620:
* Makefile.def (dependencies): Make gnattools depend on libstdc++-v3.
* Makefile.in: Regenerate.
Cary Coutant [Fri, 4 Apr 2014 16:28:23 +0000 (09:28 -0700)]
Document optional comma in linker script.
The linker script documentation does not mention the optional comma
that may follow an output section command or an overlay command.
In some cases, where a fill expression is used, and the next
output section command begins with an operator (e.g., "/DISCARD/"),
the comma may be required to separate the two commands.
Currently, GNU ld doesn't require the comma, but gold does.
ld/
PR gold/16804
* ld.texinfo: Document optional comma following output section
command and overlay command.
Ilya Tocar [Thu, 3 Apr 2014 12:40:04 +0000 (16:40 +0400)]
Add support for Intel SGX instructions
Add Intel SGX instructions support to assembler and disassembler.
gas/
* config/tc-i386.c (cpu_arch): Add .se1.
* doc/c-i386.texi: Document .se1/se1.
gas/testsuite/
* gas/i386/i386.exp: Run SE1 tests.
* gas/i386/se1.d: New file.
* gas/i386/se1.s: Ditto.
* gas/i386/x86-64-se1.d: Ditto.
* gas/i386/x86-64-se1.s: Ditto.
opcodes/
* i386-dis.c (rm_table): Add encls, enclu.
* i386-gen.c (cpu_flag_init): Add CPU_SE1_FLAGS,
(cpu_flags): Add CpuSE1.
* i386-opc.h (enum): Add CpuSE1.
(i386_cpu_flags): Add cpuse1.
* i386-opc.tbl: Add encls, enclu.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
Tristan Gingold [Thu, 3 Apr 2014 10:50:31 +0000 (12:50 +0200)]
mach-o: reject 64 bit targets when not configured for.
bfd/
* mach-o.c (bfd_mach_o_header_p): Reject 64 bit target when not
configured for.
Tristan Gingold [Fri, 4 Apr 2014 10:38:24 +0000 (12:38 +0200)]
mach-o: fix section name conversion from bfd to mach-o.
bfd/
* mach-o.c (bfd_mach_o_convert_section_name_to_mach_o): Fix
thinko on names length.
Tristan Gingold [Fri, 4 Apr 2014 10:37:50 +0000 (12:37 +0200)]
mach-o: output output_section target_index to write relocs.
bfd/
* mach-o-i386.c (bfd_mach_o_i386_swap_reloc_out): Use target index
of output_section.
* mach-o-x86-64.c (bfd_mach_o_x86_64_swap_reloc_out): Ditto.
Tristan Gingold [Thu, 3 Apr 2014 09:59:05 +0000 (11:59 +0200)]
bfd_get_arch_size: return size from arch info on non-ELF targets.
bfd/
* bfd.c (bfd_get_arch_size): Default is taken from arch.
Alan Modra [Fri, 4 Apr 2014 01:15:03 +0000 (11:45 +1030)]
Pad sections according to current script FILL.
When aligning input sections, we are supposed to take the fill pattern
from a FILL statement, if there is one in the output section statement.
ld/
* ldlang.c (lang_size_sections_1 <lang_input_section_enum>): Use
current "fill", not "output_section_statement->fill".
ld/testsuite/
* ld-scripts/fill.d, * ld-scripts/fill.t, * ld-scripts/fill_0.s,
* ld-scripts/fill_1.s, * ld-scripts/fill_2.s: New test.
* ld-scripts/data.exp: Run it.
Alan Modra [Thu, 3 Apr 2014 23:00:43 +0000 (09:30 +1030)]
daily update
Doug Evans [Thu, 3 Apr 2014 19:11:58 +0000 (12:11 -0700)]
(read_cutu_die_from_dwo): Update function comment to match previous change.
Doug Evans [Thu, 3 Apr 2014 19:07:25 +0000 (12:07 -0700)]
* dwarf2read.c (read_cutu_die_from_dwo): Fix assertion, at most one
of stub_comp_unit_die, stub_comp_dir is non-NULL.
Jon Turney [Thu, 3 Apr 2014 11:26:27 +0000 (12:26 +0100)]
* peXXigen.c (pe_print_edata): Verify edt.name lies inside
section before dereferencing.
(pe_print_idata, pe_print_edata, pe_print_reloc)
(rsrc_print_section): Don't bother interpreting the contents
of sections which have no contents.
Maria Guseva [Thu, 3 Apr 2014 10:42:05 +0000 (11:42 +0100)]
This fixes a problem building large (> 2Gb) binaries on 32-bit hosts. Using a
long type instead of long long meant that bfd_seek (SET) could be called with a
negative offset.
PR ld/16803
* elf.c (_bfd_elf_set_section_contents): Use correct type to hold
file position.
Markus Trippelsdorf [Thu, 3 Apr 2014 10:33:17 +0000 (11:33 +0100)]
This patch allows one to place the gcc's liblto_plugin in the lib/bfd-plugins directory
and have it loaded by default (as long as the --target option isn't used).
PR binutils/14698
ar.c: Set plugin_target early if plugins are supported.
nm.c: Likewise.
Tristan Gingold [Thu, 3 Apr 2014 09:49:56 +0000 (11:49 +0200)]
mach-o: fix warnings on 32 bit hosts. Display personality functions.
binutils/
* od-macho.c (printf_uint64): New function.
(dump_load_command, dump_obj_compact_unwind): Use it.
(dump_exe_compact_unwind): Display personality functions.
include/mach-o/
* unwind.h (mach_o_compact_unwind_64): Fix typo in personality.
Tristan Gingold [Thu, 3 Apr 2014 08:21:02 +0000 (10:21 +0200)]
mach-o: fix section number while writing symbols.
bfd/
* mach-o.c (bfd_mach_o_mangle_symbols): Use index from
output_section.
(bfd_mach_o_build_seg_command): Add comment. Realign segment.
Fix style.
(bfd_mach_o_build_commands, bfd_mach_o_read_thread): Fix style.
Yao Qi [Sat, 29 Mar 2014 01:41:02 +0000 (09:41 +0800)]
Escape backslash in windows path
Hi,
On windows host, we see the following ERROR,
(gdb) PASS: gdb.base/setshow.exp: set history filename ~/foobar.baz
ERROR OCCURED: couldn't compile regular expression pattern: invalid escape \ seq
uence
while executing
"expect -nobrace -i exp13 -timeout 10 -re {.*A problem internal to GDB has been
detected} {
fail "$message (GDB internal error)"
gdb_internal..."
invoked from within
"expect {
-i exp13 -timeout 10
-re ".*A problem internal to GDB has been detected" {
fail "$message (GDB internal error)"
gdb_internal_erro..."
("uplevel" body line 1)
invoked from within
"uplevel $body" REGEXP REG_EESCAPE {invalid escape \ sequence} couldn't compile
regular expression pattern: invalid escape \ sequenceERROR: Process no longer ex
ists
which leads to
UNRESOLVED: gdb.base/setshow.exp: show history filename (~/foobar.baz)
and this error is thrown from this test below:
gdb_test "show history filename" \
"The filename in which to record the command history is \"$HOME/foobar.baz\"..*" \
"show history filename (~/foobar.baz)"
HOME is a windows path, like C:\foo\bar. When it is used in gdb_test to match
output, the error is thrown because backslash is a special character in
regular expression. This patch is to escape backslash to fix this
error by using string_to_regexp.
gdb/testsuite:
2014-04-03 Yao Qi <yao@codesourcery.com>
* gdb.base/setshow.exp: Invoke string_to_regexp to HOME and PWD.
Anthony Green [Thu, 3 Apr 2014 03:55:57 +0000 (23:55 -0400)]
Add support for two new moxie sign-extension instructions
Alan Modra [Thu, 3 Apr 2014 01:36:33 +0000 (12:06 +1030)]
Fix sim breakage
Replace "size_t size" with "bfd_size_type size".
and here too.
* bfd-in.h (bfd_elf_bfd_from_remote_memory): Likewise.
* bfd-in2.h: Regenerate.
Alan Modra [Thu, 3 Apr 2014 01:27:13 +0000 (11:57 +1030)]
ChangeLog missed from last commit
Alan Modra [Thu, 3 Apr 2014 01:04:00 +0000 (11:34 +1030)]
Fix sim breakage
* elf-bfd.h (struct elf_backend_data
<elf_backend_bfd_from_remote_memory>): Replace "size_t size"
with "bfd_size_type size".
(_bfd_elf32_bfd_from_remote_memory): Likewise.
(_bfd_elf64_bfd_from_remote_memory): Likewise.
* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
* elfcode.h (bfd_from_remote_memory): Likewise.
Sriraman Tallam [Wed, 2 Apr 2014 23:46:02 +0000 (16:46 -0700)]
2014-04-02 Sriraman Tallam <tmsriram@google.com>
* icf.cc (get_section_contents): Replace copies of reloc
vectors with (const) references.
Anthony Green [Thu, 3 Apr 2014 00:04:23 +0000 (20:04 -0400)]
Add new sign-extension instructions to moxie port
Alan Modra [Wed, 2 Apr 2014 23:00:41 +0000 (09:30 +1030)]
daily update
Cary Coutant [Wed, 2 Apr 2014 22:04:36 +0000 (15:04 -0700)]
Modify gold testsuite to disable plugins added by GCC driver.
GCC 4.8 now adds linker plugin options by default, which conflict with the
--incremental tests in the testsuite. This patch checks whether the compiler
supports the -fno-use-linker-plugin option, and adds it to all link
commands.
2014-04-02 Cary Coutant <ccoutant@google.com>
* configure.ac (HAVE_PUBNAMES): Use C instead of C++.
(HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
* configure: Regenerate.
* testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
-fno-use-linker-plugin.
(LINK1, CXXLINK1): Add it to the link command.
* testsuite/Makefile.in: Regenerate.
DJ Delorie [Wed, 2 Apr 2014 20:50:29 +0000 (16:50 -0400)]
Add checks for overfar branches
Check 8 and 16 bit PCREL fixes for overflow, since we bypass the
later overflow checks in write.c. Direct relocs are left alone,
as gcc has been known to take advantage of the silent overflows
when comparing addresses to constant ranges.
Nick Clifton [Wed, 2 Apr 2014 15:29:35 +0000 (16:29 +0100)]
This fixes an internal error in GAS, triggered by the test case reported in PR 16765.
The problem was that gcc was generating assembler with missing unwind directives in it,
so that a gas_assert was being triggered. The patch replaces the assert with an error
message.
* config/tc-arm.c (create_unwind_entry): Report an error if an
attempt to recreate an unwind directive is encountered.
Tristan Gingold [Wed, 26 Mar 2014 14:01:53 +0000 (15:01 +0100)]
mach-o: read and dump: prebound_dylib, prebind_cksum, twolevel_hints.
include/mach-o:
* external.h (mach_o_prebound_dylib_command_external)
(mach_o_prebind_cksum_command_external)
(mach_o_twolevel_hints_command_external): New types.
bfd/
* mach-o.h (bfd_mach_o_twolevel_hints_command)
(bfd_mach_o_prebind_cksum_command): New types.
(bfd_mach_o_prebound_dylib_command): Rewrite.
(bfd_mach_o_load_command): Add prebind_cksum and twolevel_hints
fields.
* mach-o.c (bfd_mach_o_read_prebound_dylib): Read and decode the
command.
(bfd_mach_o_read_prebind_cksum): New function.
(bfd_mach_o_read_twolevel_hints): Ditto.
(bfd_mach_o_read_command): Handle prebind cksum and twolevel hints
commands.
binutils/
* od-macho.c (OPT_TWOLEVEL_HINTS): New macro.
(options): Add entry for twolevel_hints.
(dump_data_in_code): Fix error message.
(dump_twolevel_hints): New function.
(dump_load_command): Handle prebound dylib, prebind cksum
and twolevel hints.
(mach_o_dump): Handle twolevel hints.
Alan Modra [Wed, 2 Apr 2014 01:37:33 +0000 (12:07 +1030)]
Handle VDSO section headers past end of page
When a VDSO gets large enough that it doesn't entirely fit in one page,
but not so large that the part described by the program header exceeds
one page, then gdb/BFD doesn't read the section headers and symbol
table information. This patch cures that by passing the size of the
vdso to BFD, and fixes a number of other issues in the BFD code.
bfd/
* elfcode.h (bfd_from_remote_memory): Add "size" parameter.
Consolidate code handling possible section headers past end of
segment. Don't use p_align for page size guess, instead use
minpagesize. Take note of ld.so clearing section headers when
p_memsz > p_filesz. Handle file header specifying no section
headers. Handle zero p_align throughout. Default loadbase to
zero. Add comments. Rename contents_size to high_offset, and
make it a bfd_vma. Delete unnecessary bfd_set_error calls.
* bfd-in.h (bfd_elf_bfd_from_remote_memory): Update prototpe.
* elf-bfd.h (struct elf_backend_data <elf_backend_from_remote_memory>):
Likewise.
(_bfd_elf32_bfd_from_remote_memory): Likewise.
(_bfd_elf64_bfd_from_remote_memory): Likewise.
* elf.c (bfd_elf_bfd_from_remote_memory): Adjust.
* bfd-in2.h: Regnerate.
gdb/
* symfile-mem.c (symbol_file_add_from_memory): Add size parameter.
Pass to bfd_elf_bfd_from_remote_memory. Adjust all callers.
(struct symbol_file_add_from_memory_args): Add size field.
(find_vdso_size): New function.
(add_vsyscall_page): Attempt to find vdso size.
Alan Modra [Tue, 1 Apr 2014 23:00:43 +0000 (09:30 +1030)]
daily update
Doug Evans [Tue, 1 Apr 2014 17:17:12 +0000 (10:17 -0700)]
* dwarf2read.c (read_cutu_die_from_dwo): Improve comment.
Tristan Gingold [Tue, 1 Apr 2014 12:34:04 +0000 (14:34 +0200)]
bfd/mach-o: avoid a crash when num == 0 in reloc.
bfd/
* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Avoid to crash
when num == 0.
Tristan Gingold [Wed, 26 Mar 2014 09:41:16 +0000 (10:41 +0100)]
mach-o: display data_in_code.
binutils/
* od-macho.c (OPT_DATA_IN_CODE): New macro.
(options): Add entry for data in code.
(mach_o_help): Ditto.
(data_in_code_kind_name): New array.
(dump_data_in_code): New function.
(dump_load_command): Handle data in code.
(mach_o_dump): Ditto.
(dump_header): Display a terminal newline.
Tristan Gingold [Fri, 21 Mar 2014 15:56:39 +0000 (16:56 +0100)]
darwin-nat: avoid crash while debugging gdb.
it is possible that gdb gets mach exceptions from an unknown inferior. This
happens when an inferior creates a child and that child gets a signal.
So instead of reporting messages with unknown origins, simply reply to these
notifications. The kernel will then post the unix signal.
gdb/
* darwin-nat.c (darwin_encode_reply): Add prototype.
(darwin_decode_exception_message): Reply to unknown inferiors.
(darwin_decode_message): Handle message by id. Ignore message
to unknown inferior.
(darwin_wait): Discard unknown messages, add debug trace.
Anton Blanchard [Mon, 31 Mar 2014 02:32:07 +0000 (13:32 +1100)]
gdb.arch/ppc64-atomic-inst.exp: Improve error handling.
gdb/testsuite/
2014-04-01 Anton Blanchard <anton@samba.org>
* gdb.arch/ppc64-atomic-inst.exp: Use untested. Make test
messages unique.
Anton Blanchard [Mon, 31 Mar 2014 01:03:01 +0000 (12:03 +1100)]
gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile, prepare_for_testing.
gdb/testsuite/
2014-04-01 Anton Blanchard <anton@samba.org>
* gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile,
prepare_for_testing.
Anton Blanchard [Fri, 28 Mar 2014 01:37:37 +0000 (12:37 +1100)]
Fix ppc64 single step over atomic sequence testcase.
The current ppc64 single step over atomic sequence testcase is written
in C and breaks with some versions of gcc. Convert the test to
assembly and use stepi to step through it.
gdb/testsuite/
2014-04-01 Anton Blanchard <anton@samba.org>
* gdb.arch/ppc64-atomic-inst.c: Remove.
* gdb.arch/ppc64-atomic-inst.S: New file.
* gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase.
Doug Evans [Mon, 31 Mar 2014 23:51:37 +0000 (16:51 -0700)]
dwarf2read.c (read_cutu_die_from_dwo): Delete unused local comp_dir_string.
Alan Modra [Mon, 31 Mar 2014 23:00:55 +0000 (09:30 +1030)]
daily update
Doug Evans [Mon, 31 Mar 2014 19:07:48 +0000 (12:07 -0700)]
New option "set print symbol-loading".
* NEWS: Mention it.
* solib.c (solib_read_symbols): Only print symbol loading messages
if requested.
(solib_add): If symbol loading is in "brief" mode, notify user
symbols are being loaded.
(reload_shared_libraries_1): Ditto.
* symfile.c (print_symbol_loading_off): New static global.
(print_symbol_loading_brief): New static global.
(print_symbol_loading_full): New static global.
(print_symbol_loading_enums): New static global.
(print_symbol_loading): New static global.
(print_symbol_loading_p): New function.
(symbol_file_add_with_addrs): Only print symbol loading messages
if requested.
(_initialize_symfile): Register "print symbol-loading" set/show
command.
* symfile.h (print_symbol_loading_p): Declare.
doc/
* gdb.texinfo (Symbols): Document set/show print symbol-loading.
testsuite/
* gdb.base/print-symbol-loading-lib.c: New file.
* gdb.base/print-symbol-loading-main.c: New file.
* gdb.base/print-symbol-loading.exp: New file.
Nick Clifton [Mon, 31 Mar 2014 12:14:44 +0000 (13:14 +0100)]
This is a fix for PR ld/16744 which showed that an object file linked with -r and -z [no]execstack
would not honour the [no]execstack. Fully linked binaries use a special segment to indicate the
state of the stack, but relocatable object files only have sections, and .note.GNU-stack was not
being created.
* emultempl/elf32.em (_after_open): Create a .note.GNU-stack
section when performing a relocatable link with -z [no]execstack
specified.
Marcus Shawcroft [Mon, 31 Mar 2014 11:58:48 +0000 (12:58 +0100)]
[AArch64] Fixup ld-aarch64/eh-frame.d expected PC range.
Fix the expected output for ld-aarch64/eh-frame.d. This issue was
exposed by the recent fix to the output of objdump -Wf here:
https://sourceware.org/ml/binutils/2014-03/msg00251.html
Yao Qi [Mon, 31 Mar 2014 06:20:05 +0000 (14:20 +0800)]
Allow ';' as a directory separator
Hi,
I find two fails in source-dir.exp on mingw32 host.
(gdb) directory /nOtExStInG/a /nOtExStInG/b /nOtExStInG/c^M
Warning: /nOtExStInG/a: No such file or directory.^M
Warning: /nOtExStInG/b: No such file or directory.^M
Warning: /nOtExStInG/c: No such file or directory.^M
Source directories searched: /nOtExStInG/a;/nOtExStInG/b;/nOtExStInG/c;$cdir;$cwd^M
(gdb) FAIL: gdb.base/source-dir.exp: directory /nOtExStInG/a /nOtExStInG/b /nOtExStInG/c
directory /nOtExStInG/b /nOtExStInG/d /nOtExStInG/c^M
Warning: /nOtExStInG/b: No such file or directory.^M
Warning: /nOtExStInG/d: No such file or directory.^M
Warning: /nOtExStInG/c: No such file or directory.^M
Source directories searched: /nOtExStInG/b;/nOtExStInG/d;/nOtExStInG/c;/nOtExStInG/a;$cdir;$cwd^M
(gdb) FAIL: gdb.base/source-dir.exp: directory /nOtExStInG/b /nOtExStInG/d /nOtExStInG/c
The regular expression expects ':' and ';' is path separator on Windows.
This patch is to allow ';' as a path separator in regular expression.
This patch is similar to Dan's patch to fix a similar problem here
Re: directory separators on minGW hosts
https://sourceware.org/ml/gdb-patches/2006-02/msg00359.html
It is obvious. Pushed it in.
gdb/testsuite:
2014-03-31 Yao Qi <yao@codesourcery.com>
* gdb.base/source-dir.exp: Allow ';' as a directory separator.
Alan Modra [Sun, 30 Mar 2014 23:00:40 +0000 (09:30 +1030)]
daily update
Doug Evans [Sun, 30 Mar 2014 19:37:50 +0000 (12:37 -0700)]
* infrun.c (set_last_target_status): New function.
(handle_inferior_event): Call it.
Doug Evans [Sun, 30 Mar 2014 19:24:31 +0000 (12:24 -0700)]
* inferior.h (enum stop_kind): Improve comment.
Doug Evans [Sun, 30 Mar 2014 19:13:29 +0000 (12:13 -0700)]
* gdb.texinfo (Non-Stop Mode): Remove trailing whitespace.
(Background Execution): Ditto.
Alan Modra [Sat, 29 Mar 2014 23:00:39 +0000 (09:30 +1030)]
daily update
Chris Faylor [Sat, 29 Mar 2014 20:01:46 +0000 (16:01 -0400)]
* ChangeLog: Fix duplicate entry. Set date on entry correctly.
Denis Chertykov [Sat, 29 Mar 2014 05:53:16 +0000 (09:53 +0400)]
* config/tc-avr.c: Add specified_mcu variable for selected mcu.
(enum options): add OPTION_RMW_ISA for -mrmw option.
(struct option md_longopts): Add mrmw option.
(md_show_usage): add -mrmw option description.
(md_parse_option): Update isa details if -mrmw option specified.
* doc/c-avr.texi: Add doc for new option -mrmw.
* gas/avr/avr.exp: Run new tests.
* gas/avr/rmw.d: Add test for additional ISA support.
* gas/avr/rmw.s: Ditto.
Denis Chertykov [Sat, 29 Mar 2014 05:46:33 +0000 (09:46 +0400)]
* gas/ChangeLog: Revert
* gas/config/tc-avr.c: Revert
* gas/doc/c-avr.texi: Revert
* gas/testsuite/ChangeLog: Revert
* gas/testsuite/gas/avr/avr.exp: Revert
* gas/testsuite/gas/avr/rmw.d: Revert
* gas/testsuite/gas/avr/rmw.s: Revert
This reverts commit
d24e46e3e247e46eb2f5e7ebb5efd0f9fcc5fcdd.
Denis Chertykov [Sat, 29 Mar 2014 05:41:32 +0000 (09:41 +0400)]
* config/tc-avr.c: Add specified_mcu variable for selected mcu.
(enum options): add OPTION_RMW_ISA for -mrmw option.
(struct option md_longopts): Add mrmw option.
(md_show_usage): add -mrmw option description.
(md_parse_option): Update isa details if -mrmw option specified.
* doc/c-avr.texi: Add doc for new option -mrmw.
* gas/avr/avr.exp: Run new tests.
* gas/avr/rmw.d: Add test for additional ISA support.
* gas/avr/rmw.s: Ditto.
Alan Modra [Fri, 28 Mar 2014 23:00:47 +0000 (09:30 +1030)]
daily update
Joel Brobecker [Thu, 20 Mar 2014 14:43:08 +0000 (07:43 -0700)]
[varobj] false type-changed status for reference to Ada array
Given the following variable...
BT : Bounded := New_Bounded (Low => 1, High => 3);
... where type Bounded is defined as a simple unconstrained array:
type Bounded is array (Integer range <>) of Integer;
Creating a varobj for that variable, and immediately asking for
varobj updates, GDB says that our varobj changed types!
(gdb)
-var-create bt * bt
^done,name="bt",numchild="3",value="[3]",type="<ref> array (1 .. 3) of integer",has_more="0"
(gdb)
-var-update 1 *
^done,changelist=[{name="bt",value="[3]",in_scope="true",type_changed="true",new_type="<ref> array (1 .. 3) of integer",new_num_children="3",has_more="0"}]
The expected output for the -var-update command is, in this case:
(gdb)
-var-update 1 *
^done,changelist=[]
The problem occurs because the ada-varobj module does not handle
references, and while the references gets stripped when the varobj
gets created, it doesn't when computing varobj updates.
More specifically, when creating the varobj, varobj_create creates
a new value which is a reference to a TYPE_CODE_ARRAY. It then calls
install_new_value which calls coerce_ref with the following comment:
/* We are not interested in the address of references, and given
that in C++ a reference is not rebindable, it cannot
meaningfully change. So, get hold of the real value. */
if (value)
value = coerce_ref (value);
This leaves the varobj's type component still a ref, while
the varobj's value is now our array, without the ref. This explains
why the "value" field in the varobj indicates an array with 3 elements
"[3]" while the "type" field shows a ref to an array. Generally
speaking, most users have said that showing the ref was a useful
piece of information, so this patch is not touching this part.
Next, when the user issues the -var-update request, varobj_update
calls value_of_root to compute the varobj's new value as well as
determine whether the value's type has changed or not. What happens
in a nutshell is that it calls value_of_root_1 (which re-evaluates
the expression and returns the corresponding new value), finds that
the new value is not NULL, and thus asks whether it has mutated:
else if (varobj_value_has_mutated (var, value, value_type (value)))
This then indirectly delegates the determination to the language-specific
callback, which fails, because it does not handle references.
This patch fixes the issue by adjusting varobj_value_has_mutated to
expect references, and strip them when seen. This allows the various
language-specific implementations to remain unaware of references.
gdb/ChangeLog:
* varobj.c (varobj_value_has_mutated): If NEW_VALUE is
a reference, strip the reference layer before calling
the lang_ops value_has_mutated callback.
gdb/testsuite/ChangeLog:
* gdb.ada/mi_dyn_arr: New testcase.
Alan Modra [Thu, 27 Mar 2014 23:00:54 +0000 (09:30 +1030)]
daily update
Sergio Durigan Junior [Thu, 27 Mar 2014 22:10:40 +0000 (19:10 -0300)]
Remove `expout*' globals from parser-defs.h
This commit removes the "expout*" globals from our parser code, turning
them into a structure that is passed when an expression needs to be
evaluated. This is the initial step to make our parser less
"globalized".
This is mostly a mechanical patch, which creates a structure containing
the "expout*" globals and then modify all the functions that handle them
in order to take the structure as argument. It is big, and has been
reviewed at least 4 times, so I think everything is covered.
Below you can see the message links from the discussions:
- First attempt:
<https://sourceware.org/ml/gdb-patches/2012-01/msg00522.html>
Message-ID: <m3k44s7qej.fsf@gmail.com>
- Second attempt:
<https://sourceware.org/ml/gdb-patches/2012-06/msg00054.html>
Message-Id: <
1338665528-5932-1-git-send-email-sergiodj@redhat.com>
- Third attempt:
<https://sourceware.org/ml/gdb-patches/2014-01/msg00949.html>
Message-Id: <
1390629467-27139-1-git-send-email-sergiodj@redhat.com>
- Fourth (last) attempt:
<https://sourceware.org/ml/gdb-patches/2014-03/msg00546.html>
Message-Id: <
1395463432-29750-1-git-send-email-sergiodj@redhat.com>
gdb/
2014-03-27 Sergio Durigan Junior <sergiodj@redhat.com>
Remove some globals from our parser.
* language.c (unk_lang_parser): Add "struct parser_state"
argument.
* language.h (struct language_defn) <la_parser>: Likewise.
* parse.c (expout, expout_size, expout_ptr): Remove variables.
(initialize_expout): Add "struct parser_state" argument.
Rewrite function to use the parser state.
(reallocate_expout, write_exp_elt, write_exp_elt_opcode,
write_exp_elt_sym, write_exp_elt_block, write_exp_elt_objfile,
write_exp_elt_longcst, write_exp_elt_dblcst,
write_exp_elt_decfloatcst, write_exp_elt_type,
write_exp_elt_intern, write_exp_string, write_exp_string_vector,
write_exp_bitstring, write_exp_msymbol, mark_struct_expression,
write_dollar_variable): Likewise.
(parse_exp_in_context_1): Use parser state.
(insert_type_address_space): Add "struct parser_state" argument.
Use parser state.
(increase_expout_size): New function.
* parser-defs.h: Forward declare "struct language_defn" and
"struct parser_state".
(expout, expout_size, expout_ptr): Remove extern declarations.
(parse_gdbarch, parse_language): Rewrite macro declarations to
accept the parser state.
(struct parser_state): New struct.
(initialize_expout, reallocate_expout, write_exp_elt_opcode,
write_exp_elt_sym, write_exp_elt_longcst, write_exp_elt_dblcst,
write_exp_elt_decfloatcst, write_exp_elt_type,
write_exp_elt_intern, write_exp_string, write_exp_string_vector,
write_exp_bitstring, write_exp_elt_block, write_exp_elt_objfile,
write_exp_msymbol, write_dollar_variable,
mark_struct_expression, insert_type_address_space): Add "struct
parser_state" argument.
(increase_expout_size): New function.
* utils.c (do_clear_parser_state): New function.
(make_cleanup_clear_parser_state): Likewise.
* utils.h (make_cleanup_clear_parser_state): New function
prototype.
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token):
Update calls to write_exp* in order to pass the parser state.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* i386-tdep.c (i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
(stap_parse_single_operand): Likewise.
(stap_parse_argument_1): Likewise.
(stap_parse_argument): Use parser state.
* stap-probe.h: Include "parser-defs.h".
(struct stap_parse_info) <pstate>: New field.
* c-exp.y (parse_type): Rewrite to use parser state.
(yyparse): Redefine to c_parse_internal.
(pstate): New global variable.
(parse_number): Add "struct parser_state" argument.
(write_destructor_name): Likewise.
(type_exp): Update calls to write_exp* and similars in order to
use parser state.
(exp1, exp, variable, qualified_name, space_identifier,
typename, typebase): Likewise.
(write_destructor_name, parse_number, lex_one_token,
classify_name, classify_inner_name, c_parse): Add "struct
parser_state" argument. Update function to use parser state.
* c-lang.h: Forward declare "struct parser_state".
(c_parse): Add "struct parser_state" argument.
* ada-exp.y (parse_type): Rewrite macro to use parser state.
(yyparse): Redefine macro to ada_parse_internal.
(pstate): New variable.
(write_int, write_object_renaming, write_var_or_type,
write_name_assoc, write_exp_op_with_string, write_ambiguous_var,
type_int, type_long, type_long_long, type_float, type_double,
type_long_double, type_char, type_boolean, type_system_address):
Add "struct parser_state" argument.
(exp1, primary, simple_exp, relation, and_exp, and_then_exp,
or_exp, or_else_exp, xor_exp, type_prefix, opt_type_prefix,
var_or_type, aggregate, aggregate_component_list,
positional_list, others, component_group,
component_associations): Update calls to write_exp* and similar
functions in order to use parser state.
(ada_parse, write_var_from_sym, write_int,
write_exp_op_with_string, write_object_renaming,
find_primitive_type, write_selectors, write_ambiguous_var,
write_var_or_type, write_name_assoc, type_int, type_long,
type_long_long, type_float, type_double, type_long_double,
type_char, type_boolean, type_system_address): Add "struct
parser_state" argument. Adjust function to use parser state.
* ada-lang.c (parse): Likewise.
* ada-lang.h: Forward declare "struct parser_state".
(ada_parse): Add "struct parser_state" argument.
* ada-lex.l (processInt, processReal): Likewise. Adjust all
calls to both functions.
* f-exp.y (parse_type, parse_f_type): Rewrite macros to use
parser state.
(yyparse): Redefine macro to f_parse_internal.
(pstate): New variable.
(parse_number): Add "struct parser_state" argument.
(type_exp, exp, subrange, typebase): Update calls to write_exp*
and similars in order to use parser state.
(parse_number): Adjust code to use parser state.
(yylex): Likewise.
(f_parse): New function.
* f-lang.h: Forward declare "struct parser_state".
(f_parse): Add "struct parser_state" argument.
* jv-exp.y (parse_type, parse_java_type): Rewrite macros to use
parser state.
(yyparse): Redefine macro for java_parse_internal.
(pstate): New variable.
(push_expression_name, push_expression_name, insert_exp): Add
"struct parser_state" argument.
(type_exp, StringLiteral, Literal, PrimitiveType, IntegralType,
FloatingPointType, exp1, PrimaryNoNewArray, FieldAccess,
FuncStart, MethodInvocation, ArrayAccess, PostfixExpression,
PostIncrementExpression, PostDecrementExpression,
UnaryExpression, PreIncrementExpression, PreDecrementExpression,
UnaryExpressionNotPlusMinus, CastExpression,
MultiplicativeExpression, AdditiveExpression, ShiftExpression,
RelationalExpression, EqualityExpression, AndExpression,
ExclusiveOrExpression, InclusiveOrExpression,
ConditionalAndExpression, ConditionalOrExpression,
ConditionalExpression, Assignment, LeftHandSide): Update
calls to write_exp* and similars in order to use parser state.
(parse_number): Ajust code to use parser state.
(yylex): Likewise.
(java_parse): New function.
(push_variable): Add "struct parser_state" argument. Adjust
code to user parser state.
(push_fieldnames, push_qualified_expression_name,
push_expression_name, insert_exp): Likewise.
* jv-lang.h: Forward declare "struct parser_state".
(java_parse): Add "struct parser_state" argument.
* m2-exp.y (parse_type, parse_m2_type): Rewrite macros to use
parser state.
(yyparse): Redefine macro to m2_parse_internal.
(pstate): New variable.
(type_exp, exp, fblock, variable, type): Update calls to
write_exp* and similars to use parser state.
(yylex): Likewise.
(m2_parse): New function.
* m2-lang.h: Forward declare "struct parser_state".
(m2_parse): Add "struct parser_state" argument.
* objc-lang.c (end_msglist): Add "struct parser_state" argument.
* objc-lang.h: Forward declare "struct parser_state".
(end_msglist): Add "struct parser_state" argument.
* p-exp.y (parse_type): Rewrite macro to use parser state.
(yyparse): Redefine macro to pascal_parse_internal.
(pstate): New variable.
(parse_number): Add "struct parser_state" argument.
(type_exp, exp1, exp, qualified_name, variable): Update calls to
write_exp* and similars in order to use parser state.
(parse_number, yylex): Adjust code to use parser state.
(pascal_parse): New function.
* p-lang.h: Forward declare "struct parser_state".
(pascal_parse): Add "struct parser_state" argument.
* go-exp.y (parse_type): Rewrite macro to use parser state.
(yyparse): Redefine macro to go_parse_internal.
(pstate): New variable.
(parse_number): Add "struct parser_state" argument.
(type_exp, exp1, exp, variable, type): Update calls to
write_exp* and similars in order to use parser state.
(parse_number, lex_one_token, classify_name, yylex): Adjust code
to use parser state.
(go_parse): Likewise.
* go-lang.h: Forward declare "struct parser_state".
(go_parse): Add "struct parser_state" argument.