aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-12-30Automatic date update in version.inGDB Administrator1-1/+1
2017-12-29Automatic date update in version.inGDB Administrator1-1/+1
2017-12-28RISC-V: Add missing privileged spec registers.Jim Wilson5-148/+736
gas/ * testsuite/gas/riscv/priv-reg.d, testsuite/gas/riscv/priv-reg.s: New. include/ * opcode/riscv-opc.h (DECLARE_CSR): Add missing privileged registers. Sort to match privileged spec documentation order. (DECLARE_CSR_ALIAS): Add ubadaddr, and comments.
2017-12-28Remove unused HP-UX TARGET_OBJECT_ enumsSimon Marchi2-9/+5
These two enumerators are unused, remove them. gdb/ChangeLog: * target.h (enum target_object) <TARGET_OBJECT_HPUX_UREGS, TARGET_OBJECT_HPUX_SOLIB_GOT>: Remove.
2017-12-28Automatic date update in version.inGDB Administrator1-1/+1
2017-12-27tdesc: handle arbitrary strings in tdesc_register_in_reggroup_pStafford Horne8-41/+57
tdesc_register_in_reggroup_p in now able to handle arbitrary groups. This is useful when groups are created while the target descriptor file is received from the remote. This can be the case of a soft core target processor where registers/groups can change. gdb/ChangeLog: yyyy-mm-dd Franck Jullien <franck.jullien@gmail.com> Stafford Horne <shorne@gmail.com> * target-descriptions.c (tdesc_register_in_reggroup_p): Support arbitrary strings. (tdesc_use_registers): Add logic to register new reggroups. (tdesc_reg::group): Update comment to indicate we allow arbitrary strings. * NEWS (Changes since GDB 8.0): Announce that GDB supports arbitrary reggroups. gdb/testsuite/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * gdb.xml/extra-regs.xml: Add example foo reggroup. * gdb.xml/tdesc-regs.exp: Add test to check for foo reggroup. gdb/doc/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * gdb.texinfo (Target Description Format): Explain that arbitrary strings are now allowed for register groups.
2017-12-27reggroups: Add reggroup_gdbarch_new, reggroup_find for dynamic reggroupsStafford Horne3-0/+44
Traditionally reggroups have been created via reggroup_new() during initialization code and never freed. Now, if we want to initialize reggroups dynamically (i.e. in target description) we should be able to free them. Create this function reggroup_gdbarch_new() which will allocate the reggroup memory onto the passed gdbarch obstack. Also creating reggroup_find() as a utility to find a gdbarch registered reggroup object by name. gdb/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * reggroups.c (reggroup_gdbarch_new): New function. (reggroup_find): New function. * reggroups.h (reggroup_gdbarch_new): New function. (reggroup_find): New function.
2017-12-27reggroups: Convert reggroups from post_init to pre_initStafford Horne2-11/+13
Currently the reggroups gdbarch_data cannot be manipulated until after the gdbarch is completely initialized. This is usually done when the object init depends on architecture specific fields. In the case of reggroups it only depends on the obstack being available. Coverting this to pre_init allows using reggroups during gdbarch initialization. This is needed to allow registering arbitrary reggroups during gdbarch initializations. gdb/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * reggroups.c (reggroups_init): Change to depend only on obstack rather than gdbarch. (reggroup_add): Remove logic for forcing premature init. (_initialize_reggroup): Set `reggroups_data` with gdbarch_data_register_pre_init() rather than gdbarch_data_register_post_init().
2017-12-27reggroups: Add test and docs for `info reg $reggroup` featureStafford Horne7-2/+160
Until now this feature has existed but was not documented. Adding docs and tests. gdb/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * infcmd.c (_initialize_infcmd): Add help for info reg $reggroup and info all-registers $reggroup feature. gdb/doc/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * gdb.texinfo (Registers): Document info reg $reggroup feature. gdb/testsuite/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * gdb.base/reggroups.c: New file. * gdb.base/reggroups.exp: New file.
2017-12-27Automatic date update in version.inGDB Administrator1-1/+1
2017-12-26Automatic date update in version.inGDB Administrator1-1/+1
2017-12-25Automatic date update in version.inGDB Administrator1-1/+1
2017-12-24Automatic date update in version.inGDB Administrator1-1/+1
2017-12-23Add ATTRIBUTE_PRINTF to printf_field_type_assignmentSimon Marchi2-0/+6
Get rid of: /home/simark/src/binutils-gdb/gdb/target-descriptions.c:2026:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral] vprintf_unfiltered (fmt, args); when building with clang. gdb/ChangeLog: * target-descriptions.c (print_c_tdesc) <printf_field_type_assignment>: Add ATTRIBUTE_PRINTF.
2017-12-23Automatic date update in version.inGDB Administrator1-1/+1
2017-12-22Automatic date update in version.inGDB Administrator1-1/+1
2017-12-21Do not emit "field_type" var if not needed on "maint print c-tdesc"Simon Marchi37-51/+86
While fiddling a bit with -Wunused-variable, Sergio noticed that "maint print c-tdesc" was always generating code for the "tdesc_type *field_type" variable, even when it wasn't used. This is caught by GCC when using -Wunused-variable, of course. This patch changes the print_c_tdesc class to only output the field declaration when we actually need it. It shouldn't be necessary to do the same with the other variable declarations (type_with_fields and element_type), because they are always if they are declared. The C files in features/ are regenerated, some declarations of field_type are removed, as expected, while some others move to where they are used for the first time. gdb/ChangeLog: * target-descriptions.c (print_c_tdesc) <visit>: Don't output field_type declaration, use printf_field_type_assignment instead. <printf_field_type_assignment>: New method. * features/aarch64-core.c, features/aarch64-fpu.c features/arc-arcompact.c, features/arc-v2.c, features/arm/arm-with-iwmmxt.c, features/i386/32bit-core.c, features/i386/32bit-mpx.c, features/i386/32bit-sse.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-mpx.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/or1k.c, features/rs6000/powerpc-7400.c, features/rs6000/powerpc-altivec32.c, features/rs6000/powerpc-altivec32l.c, features/rs6000/powerpc-altivec64.c, features/rs6000/powerpc-altivec64l.c, features/rs6000/powerpc-cell32l.c, features/rs6000/powerpc-cell64l.c, features/rs6000/powerpc-isa205-altivec32l.c, features/rs6000/powerpc-isa205-altivec64l.c, features/rs6000/powerpc-isa205-vsx32l.c, features/rs6000/powerpc-isa205-vsx64l.c, features/rs6000/powerpc-vsx32.c, features/rs6000/powerpc-vsx32l.c, features/rs6000/powerpc-vsx64.c, features/rs6000/powerpc-vsx64l.c, features/s390-gs-linux64.c, features/s390-tevx-linux64.c, features/s390-vx-linux64.c, features/s390x-gs-linux64.c, features/s390x-tevx-linux64.c, features/s390x-vx-linux64.c: Re-generate.
2017-12-20Remove write-only assignment in rs6000-tdep.cUros Bizjak2-1/+5
The result of this memory read is never used, so it can be removed. gdb/ChangeLog: * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Remove write-only assignment to "insn" variable.
2017-12-21Automatic date update in version.inGDB Administrator1-1/+1
2017-12-20RISC-V: Add compressed instruction hints, and a few misc cleanups.Jim Wilson16-13/+156
gas/ * config/tc-riscv.c (risc_ip) <o>: Add comment. * testsuite/gas/riscv/c-nonzero-imm.d, * testsuite/gas/riscv/c-nonzero-imm.l, * testsuite/gas/riscv/c-nonzero-imm.s, * testsuite/gas/riscv/c-nonzero-reg.d, * testsuite/gas/riscv/c-nonzero-reg.l, * testsuite/gas/riscv/c-nonzero-reg.s, * testsuite/gas/riscv/c-zero-imm-64.d, * testsuite/gas/riscv/c-zero-imm-64.s, * testsuite/gas/riscv/c-zero-imm.d, testsuite/gas/riscv/c-zero-imm.s, * testsuite/gas/riscv/c-zero-reg.d, * testsuite/gas/riscv/c-zero-reg.s: New. opcodes/ * riscv-opc.c (match_c_add_with_hint, match_c_lui_with_hint): New. (riscv_opcodes) <li>: Delete "d,0" line. Change Cj to Co. <andi, and, add, addiw, addw, c.addi>: Change Cj to Co. <add>: Add explanatory comment for 4-operand add instruction. <c.nop>: Add support for immediate operand. <c.mv, c.add>: Use match_c_add_with_hint instead of match_c_add. <c.lui>: Use match_c_lui_with_hint instead of match_c_lui. <c.li, c.slli>: Use match_opcode instead of match_rd_nonzero.
2017-12-20[Cell/B.E.] Fix regression due to gdbarch_significant_addr_bitUlrich Weigand3-0/+13
On Cell/B.E. multi-architecture debugging we use a "merged" address space that encodes both the main PowerPC address space and the local store address spaces of all active SPUs. This will always occupy 64 bits. However, gdbarch_addr_bit is set to 32 on SPU, and may be set to 32 as well on PowerPC. Since the new gdbarch_significant_addr_bit defaults to the value of gdbarch_addr_bit, this means addresses may be improperly truncated. Work around this problem by explicitly setting gdbarch_significant_addr_bit to 64 both for the SPU target and also for PowerPC target that support Cell/B.E. execution. gdb/ChangeLog: 2017-12-20 Ulrich Weigand <uweigand@de.ibm.com> * spu-tdep.c (spu_gdbarch_init): Set set_gdbarch_significant_addr_bit to 64 bits. (ppc_linux_init_abi): Likewise, if Cell/B.E. is supported.
2017-12-19Fix ChangeLog formattingSimon Marchi2-2/+2
Doing some unrelated grepping found that there were some missing spaces, fix it.
2017-12-20Automatic date update in version.inGDB Administrator1-1/+1
2017-12-19Correct disassembly of dot product instructions.Tamar Christina10-438/+471
Dot products deviate from the normal disassembly rules for lane indexed instruction. Their canonical representation is in the form of: v0.2s, v0.8b, v0.4b[0] instead of v0.2s, v0.8b, v0.b[0] to try to denote that these instructions select 4x 1 byte elements instead of a single 1 byte element. Previously we were disassembling them following the normal rules, this patch corrects the disassembly. gas/ PR gas/22559 * config/tc-aarch64.c (vectype_to_qualifier): Support AARCH64_OPND_QLF_S_4B. * gas/testsuite/gas/aarch64/dotproduct.d: Update disassembly. include/ PR gas/22559 * aarch64.h (aarch64_opnd_qualifier): Add AARCH64_OPND_QLF_S_4B. opcodes/ PR gas/22559 * aarch64-asm.c (aarch64_ins_reglane): Change AARCH64_OPND_QLF_S_B to AARCH64_OPND_QLF_S_4B * aarch64-dis.c (aarch64_ext_reglane): Change AARCH64_OPND_QLF_S_B to AARCH64_OPND_QLF_S_4B * aarch64-opc.c (aarch64_opnd_qualifiers): Add 4b variant. * aarch64-tbl.h (QL_V2DOT): Change S_B to S_4B.
2017-12-19Add support for V_4B so we can properly reject it.Tamar Christina9-3/+47
Previously parse_vector_type_for_operand was changed to allow the use of 4b register size for indexed lane instructions. However this had the unintended side effect of also allowing 4b for normal vector registers. Because this support was only partial the rest of the tool silently treated 4b as 8b and continued. This patch adds full support for 4b so it can be properly distinguished from 8b and the correct errors are generated. With this patch you still can't encode any instruction which actually requires v<num>.4b but such instructions don't exist so to prevent needing a workaround in get_vreg_qualifier_from_value this was just omitted. gas/ PR gas/22529 * config/tc-aarch64.c (vectype_to_qualifier): Support AARCH64_OPND_QLF_V_4B. * gas/testsuite/gas/aarch64/pr22529.s: New. * gas/testsuite/gas/aarch64/pr22529.d: New. * gas/testsuite/gas/aarch64/pr22529.l: New. include/ PR gas/22529 * opcode/aarch64.h (aarch64_opnd_qualifier): Add AARCH64_OPND_QLF_V_4B. opcodes/ PR gas/22529 * aarch64-opc.c (aarch64_opnd_qualifiers): Add 4b variant.
2017-12-19Stop readelf from complaining about relocation sections with an sh_info ↵Nick Clifton2-5/+15
field of 0 in dynamic executables. PR 22587 * readelf.c (process_section_headers): Do not complain about an sh_info field of 0 in relocation sections of ET_EXEC or ET_DYN type executables.
2017-12-19Automatic date update in version.inGDB Administrator1-1/+1
2017-12-19PR22626, invalid dynindx used for dynamic relocs against section symsAlan Modra2-8/+22
_bfd_elf_link_renumber_dynsyms is called twice by the linker. The first call in bfd_elf_size_dynamic_sections is just to answer the question as to whether there are there any dynamic symbols. The second call in bfd_elf_size_dynsym_hash_dynstr sets the st_shndx value that dynamic symbols will have. strip_excluded_output_sections is called between these two calls. So sections seen on the first _bfd_elf_link_renumber_dynsyms pass might differ from those seen on the second pass. Unfortunately, that can result in a stripped section's dynamic symbol being assigned a dynindx on the first pass but not corrected to the final value (of zero, ie. not dynamic) on the second pass. PowerPC, x86, mips, and most other targets that emit dynamic section symbols, just test that section symbol dynindx is non-zero before using a given section symbol in dynamic relocations. This patch prevents _bfd_elf_link_renumber_dynsyms from setting any section symbol dynindx on the first pass. PR 22626 * elflink.c (_bfd_elf_link_renumber_dynsyms): Don't set section dynindx when section_sym_count is NULL. (bfd_elf_size_dynamic_sections): Pass NULL section_sym_count to preliminary _bfd_elf_link_renumber_dynsyms call.
2017-12-19Test binutils_assemble return valueAlan Modra12-290/+323
This is a followup to "binutils nm testsuite tidy". Since the perror in binutils_assemble has been removed, we need to take more care in failure paths. The patch also fixed a number of .exp files that have multiple tests, where an assembly failure returns from the .exp file. In most cases it is nicer to attempt all tests. * testsuite/binutils-all/ar.exp (unique_symbol): Don't run AR if assembly fails. * testsuite/binutils-all/arc/objdump.exp (check_assembly): If objfile is empty, fail test. * testsuite/binutils-all/arm/objdump.exp: Don't return if assembly fails for a test, continue on to other tests. * testsuite/binutils-all/bfin/objdump.exp: Likewise. * testsuite/binutils-all/hppa/objdump.exp: Likewise. * testsuite/binutils-all/m68k/objdump.exp: Likewise. * testsuite/binutils-all/vax/objdump.exp: Likewise. * testsuite/binutils-all/size.exp: Likewise. * testsuite/binutils-all/nm.exp: Likewise. Move PR12753 test. * testsuite/binutils-all/objcopy.exp: Don't perror on assembly fail. * testsuite/binutils-all/objdump.exp: Report assembly fails.
2017-12-18Decode expression lists used with DW_AT_byte_size and other DWARF attributes.Nick Clifton2-0/+23
PR 22532 * dwarf.c (read_and_display_attr_value): Add attributes that might use the DW_FORM_exprloc form, and if so, display the decoded location expression list.
2017-12-18Resolve PR 22493 - the encoding to be used when pushing the stack pointer ↵Nick Clifton2-0/+11
onto the stack. PR 22493 * config/tc-arm.c (encode_ldmstm): Do not use A2 encoding of the PUSH insn when pushing the stack pointer.
2017-12-18x86: fold certain AVX and AVX2 templatesJan Beulich7-4144/+841
Just like for instructions in GPRs, there's no need to have separate templates for otherwise identical insns acting on XMM or YMM registers (or memory of the same size).
2017-12-18x86: fold RegXMM/RegYMM/RegZMM into RegSIMDJan Beulich11-46431/+46461
... qualified by their respective sizes, allowing to drop FirstXmm0 at the same time.
2017-12-18x86: drop FloatReg and FloatAccJan Beulich8-32592/+32603
Express them as Reg|Tbyte and Acc|Tbyte respectively.
2017-12-18x86: replace Reg8, Reg16, Reg32, and Reg64Jan Beulich10-32899/+33388
Use a combination of a single new Reg bit and Byte, Word, Dword, or Qword instead. Besides shrinking the number of operand type bits this has the benefit of making register handling more similar to accumulator handling (a generic flag is being accompanied by a "size qualifier"). It requires, however, to split a few insn templates, as it is no longer correct to have combinations like Reg32|Reg64|Byte. This slight growth in size will hopefully be outweighed by this change paving the road for folding a presumably much larger number of templates later on.
2017-12-17improved error message when getting an exception printing a variableJoel Brobecker6-5/+173
Consider the following Ada code defining a global variable whose type is an array of static bounds (1 .. 2), but where its elements are a variant record whose size is not statically known: type Ints is array (Natural range <>) of Integer; type Bounded_Ints (Max_Size : Natural) is record Length : Natural := 0; Objs : Ints (1 .. Max_Size); end record; type Ints_Doubled is array (1 .. 2) of Bounded_Ints (Idem (0)); Global : Ints_Doubled; When compiling this program at -O2 using a GCC-6.4-based compiler on x86_64-linux, trying to print the value of that global variable yields: (gdb) p global $1 = Let's look at the debugging info, which starts with the global variable itself... .uleb128 0x19 # (DIE (0x25e) DW_TAG_variable) .long .LASF32 # DW_AT_name: "fd__global" .long 0x273 # DW_AT_type ... its type is a reference to a typedef ... .uleb128 0x14 # (DIE (0x273) DW_TAG_reference_type) .byte 0x8 # DW_AT_byte_size .long 0x202 # DW_AT_type [...] .uleb128 0x15 # (DIE (0x202) DW_TAG_typedef) .long .LASF19 # DW_AT_name: "fd__ints_doubled" .long 0x20d # DW_AT_type ... of an array (1..2) ... .uleb128 0x2 # (DIE (0x20d) DW_TAG_array_type) .long .LASF19 # DW_AT_name: "fd__ints_doubled" .long 0x15b # DW_AT_type .long 0x221 # DW_AT_sibling .uleb128 0x16 # (DIE (0x21a) DW_TAG_subrange_type) .long 0x40 # DW_AT_type .sleb128 2 # DW_AT_upper_bound .byte 0 # end of children of DIE 0x20d ... of a struct whose name is fd__Tints_doubledC: .uleb128 0x10 # (DIE (0x15b) DW_TAG_structure_type) .long .LASF11 # DW_AT_name: "fd__Tints_doubledC" .long 0x1e4 # DW_AT_GNAT_descriptive_type # DW_AT_artificial .long 0x1e4 # DW_AT_sibling .uleb128 0x7 # (DIE (0x16a) DW_TAG_member) .long .LASF4 # DW_AT_name: "max_size" [snip] The error occurs while Ada evaluator is trying to "fix" the element type inside the array, so as to determine its actual size. For that, it searches for a parallel "XVZ" variable, which, when found, contains the object's actual size. Unfortunately in our case, the variable exists but has been optimized out, as seen by the presence of a variable DIE in the debugging info, but with no address attribute: .uleb128 0x18 # (DIE (0x24e) DW_TAG_variable) .long .LASF31 # DW_AT_name: "fd__Tints_doubledC___XVZ" .long 0x257 # DW_AT_type # DW_AT_artificial Discussing this with some members of AdaCore's compiler team, it is expected that the optimizer can get rid of this variable, and we don't want to pessimize the code just to improve debuggability, since -O2 is about performance. So, the idea of this patch is not to make it work, but provide a bit more information to help users understand what kind of error is preventing GDB from being able to print the variable's value. The first hurdle we had to clear was the fact that ada_val_print traps all exceptions (including QUIT ones!), and does so completly silently. So, the fix was to add a trace of the exception being generated. While doing so, we fix an old XXX/FIXME by only catching errors, letting QUIT exceptions go through. Once this is done, we now get an error message, which gives a first clue as to what was happening: (gdb) p fd.global $1 = <error reading variable: value has been optimized out> However, it would be more useful to know which value it was that was optimized out. For that purpose, we enhanced ada-lang.c::ada_to_fixed_type_1 so as to re-throw the error with a message which indicates which variable we failed to read. With those changes, the new output is now: (gdb) p fd.global $1 = <error reading variable: unable to read value of fd__Tints_doubledC___XVZ (value has been optimized out)> gdb/ChangeLog: * ada-lang.c (ada_to_fixed_type_1): Rethrow errors with a more detailed exception message when getting an exception while trying to read the value of an XVZ variable. * ada-valprint.c (ada_val_print): Only catch RETURN_MASK_ERROR exceptions. Print an error message when an exception is caught. gdb/testsuite/ChangeLog: * gdb.dwarf2/ada-valprint-error.c: New file. * gdb.dwarf2/ada-valprint-error.exp: New file. Tested on x86_64-linux
2017-12-17(Ada) crash assigning to record component which is an arrayJoel Brobecker6-3/+91
Consider the following code, which declares a variabled called "input" of type "parameter", which is a record with one component called "u2", where the type of that component is a simple 3-element array of floating point values: type Float_Array_3 is array (1 .. 3) of Float; type parameters is record u2 : Float_Array_3; end record; input : parameters; Trying to assign a value to input.u2 causes GDB to crash: (gdb) p input.u2 := (0.25,0.5,0.75) [1] 20228 segmentation fault (core dumped) [...]/gdb The crash occurs because input.u2 is described in the debugging info as a typedef of an array. Indeed, input's type is: <1><ae9>: Abbrev Number: 7 (DW_TAG_structure_type) <aea> DW_AT_name : (indirect string, offset: 0x1045): target_wrapper__parameters [...] <2><af5>: Abbrev Number: 8 (DW_TAG_member) <af6> DW_AT_name : u2 [...] <afb> DW_AT_type : <0xaca> and, looking at DIE 0xaca to get input.u2's type, we see: <1><aca>: Abbrev Number: 4 (DW_TAG_typedef) <acb> DW_AT_name : (indirect string, offset: 0x1060): target_wrapper__float_array_3 [...] <ad1> DW_AT_type : <0xad5> We can also confirm, following the DW_AT_type attribute (0xad5), that it's a typedef of our array: <1><ad5>: Abbrev Number: 5 (DW_TAG_array_type) <ad6> DW_AT_name : (indirect string, offset: 0x1060): target_wrapper__float_array_3 [...] In fact, this scenario uncovered 2 areas where typedef handling is missing, thus causing a crash. The first happens inside assign_aggregate: if (ada_is_direct_array_type (lhs_type)) { lhs = ada_coerce_to_simple_array (lhs); lhs_type = value_type (lhs); low_index = TYPE_ARRAY_LOWER_BOUND_VALUE (lhs_type); high_index = TYPE_ARRAY_UPPER_BOUND_VALUE (lhs_type); } Here, lhs_type is a TYPE_CODE_TYPEDEF. ada_is_direct_array_type knows how to handle it, but TYPE_ARRAY_LOWER_BOUND_VALUE assumes that the given type is a TYPE_CODE_ARRAY. As such, it ends up accessing some fields in lhs_type which it shouldn't, and kaboom. We fixed this issue by making sure that the TYPE_CODE_TYPEDEF layer gets stripped. Once this is done, we hit a different kind of error, also leading to a SEGV, this time in assign_component. The code looks like this: if (TYPE_CODE (value_type (lhs)) == TYPE_CODE_ARRAY) [...] else [...] Because once again lhs is a TYPE_CODE_TYPEDEF, the check fail, and we end up assuming that lhs is a struct, executing the "else" block, which is: else { elt = ada_index_struct_field (index, lhs, 0, value_type (lhs)); elt = ada_to_fixed_value (elt); } Since lhs is not a struct, ada_index_struct_field returns NULL, which ada_to_fixed_value does not handle well, hence another crash. This patch fixes this other issue the same way, by stripping TYPE_CODE_TYPEDEF layers. gdb/ChangeLog: * ada-lang.c (assign_component): Strip any TYPE_CODE_TYPEDEF layer from lhs' type. (assign_aggregate): Likewise. gdb/testsuite: * gdb.ada/assign_arr: New testcase. Tested on x86_64-linux.
2017-12-17Ada: fix bad handling in ada_convert_actualXavier Roirand7-1/+118
Using this small example: procedure Foo is type Integer_Access is access all Integer; procedure P (A : Integer_Access) is begin null; end P; begin P (null); end Foo; and doing this debug session: (gdb) b p Breakpoint 1 at 0x402d67: file foo.adb, line 7. (gdb) print p(null) Breakpoint 1, foo.p (a=0x641010) at foo.adb:10 ... ^^^^^^^^^^ shows that something goes wrong between the initial null value and the received parameter value in the 'f' function. The value for the parameter 'a' we get is the address of the value we would expect instead of the value itself. This can be checked by doing: (gdb) p *a $1 = 0 Before this fix, in ada_convert_value, this function was looking to the actual value (the null value here) to determine if the formal (parameter 'a' in the procedure 'P' in this exemple) requires a pointer or not which is a wrong assumption and leads to push the address of the value to the inferior instead of the value itself. This is fixed by this patch. gdb/ChangeLog: * ada-lang.c (ada_convert_actual): Change the way actual value are passed to the inferior when the inferior expects a pointer type. gdb/testsuite/ChangeLog: * gdb.ada/funcall_ptr: New testcase. Tested on x86_64-linux.
2017-12-18Automatic date update in version.inGDB Administrator1-1/+1
2017-12-17x86: Check pseudo prefix without instructionH.J. Lu5-0/+32
Pseudo prefixes must be used on an instruction. Issue an error when pseudo prefix is used without instruction. PR gas/22623 * gas/config/tc-i386.c (output_insn): Check pseudo prefix without instruction. * testsuite/gas/i386/i386.exp: Run inval-pseudo. * testsuite/gas/i386/inval-pseudo.l: New file. * testsuite/gas/i386/inval-pseudo.s: Likewise.
2017-12-17Automatic date update in version.inGDB Administrator1-1/+1
2017-12-17gdb: Fix function parameter alignments in or1k-tdep.c.Stafford Horne2-9/+17
As suggested by Joel Brobecker <brobecker@adacore.com> and as per fsf coding standards. Also fix a few more issues with directly printing pointers. gdb/ChangeLog: * gdb/or1k-tdep.c (show_or1k_debug): Fix function parameter alignment. (or1k_analyse_inst): Likewise. (or1k_single_step_through_delay): Likewise. (or1k_frame_cache): Fix parameter alignment and use paddress() instead of %x.
2017-12-17gdb: Add news entries for new or1k target.Stafford Horne2-0/+9
gdb/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * NEWS (Changes since GDB 8.0): Mention new or1k target and new commands to set/show or1k debug.
2017-12-15Fix ARI warning on gdb/typeprint.c:whatis_expSergio Durigan Junior2-3/+8
I forgot to indent the "if" clause properly and put the "&&" at the beginning of the line, so ARI complained. This commit fixed it. gdb/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> * typeprint.c (whatis_exp): Fix ARI warning and reindent "if" condition.
2017-12-16Automatic date update in version.inGDB Administrator1-1/+1
2017-12-15Implement pahole-like 'ptype /o' optionSergio Durigan Junior10-66/+1050
This commit implements the pahole-like '/o' option for 'ptype', which prints the offsets and sizes of struct fields, reporting whenever there is a hole found. The output is heavily based on pahole(1), with a few modifications here and there to adjust it to our reality. Here's an example: /* offset | size */ type = struct wer : public tuv { public: /* 32 | 24 */ struct tyu { /* 32:31 | 4 */ int a1 : 1; /* 32:28 | 4 */ int a2 : 3; /* 32: 5 | 4 */ int a3 : 23; /* 35: 3 | 1 */ char a4 : 2; /* XXX 3-bit hole */ /* XXX 4-byte hole */ /* 40 | 8 */ int64_t a5; /* 48:27 | 4 */ int a6 : 5; /* 48:56 | 8 */ int64_t a7 : 3; /* total size (bytes): 24 */ } a1; /* total size (bytes): 56 */ } A big part of this patch handles the formatting logic of 'ptype', which is a bit messy. The code to handle bitfield offsets, however, took some time to craft. My thanks to Pedro Alves for figuring things out and pointing me to the right direction, as well as coming up with a way to inspect the layout of structs with bitfields (see testcase for comments). After many discussions both on IRC and at the mailing list, I tried to implement printing vtables and inherited classes. Unfortunately the code grew too complex and there were still a few corner cases failing so I had to drop the attempt. This should be implemented in a future patch. This patch is the start of a long-term work I'll do to flush the local patches we carry for Fedora GDB. In this specific case, I'm aiming at upstreaming the feature implemented by the 'pahole.py' script that is shipped with Fedora GDB: <https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-archer.patch#_311> This has been regression-tested on the BuildBot. There's a new testcase for it, along with an update to the documentation. I also thought it was worth mentioning this feature in the NEWS file. gdb/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> PR cli/16224 * NEWS (Changes since GDB 8.0): Mention new '/o' flag. * c-typeprint.c (OFFSET_SPC_LEN): New define. (c_type_print_varspec_prefix): New argument 'struct print_offset_data *'. (c_type_print_base_1): New function and prototype. (c_print_type_1): New function, with code from 'c_print_type'. (c_print_type): Use 'c_print_type_1'. (c_type_print_varspec_prefix): New argument 'struct print_offset_data *'. Use it. Call 'c_type_print_base_1' instead of 'c_print_type_base'. (print_spaces_filtered_with_print_options): New function. (output_access_specifier): Take new argument FLAGS. Modify function to call 'print_spaces_filtered_with_print_options'. (c_print_type_vtable_offset_marker): New function. (c_print_type_union_field_offset): New function. (c_print_type_struct_field_offset): New function. (c_print_type_no_offsets): New function. (c_type_print_base_struct_union): New argument 'struct print_offset_data *'. Print offsets and sizes for struct/union/class fields. * typeprint.c (const struct type_print_options type_print_raw_options): Initialize 'print_offsets'. (static struct type_print_options default_ptype_flags): Likewise. (struct print_offset_data print_offset_default_data): New variable. (whatis_exp): Handle '/o' option. (_initialize_typeprint): Add '/o' flag to ptype's help. * typeprint.h (struct print_offset_data): New struct. (struct type_print_options) <print_offsets>: New field. gdb/testsuite/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> PR cli/16224 * gdb.base/ptype-offsets.cc: New file. * gdb.base/ptype-offsets.exp: New file. gdb/doc/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> PR cli/16224 * gdb.texinfo (ptype): Add documentation for new flag '/o'.
2017-12-15Reorganize code to handle TYPE_CODE_{STRUCT,UNION} on 'c_type_print_base'Sergio Durigan Junior2-434/+410
While doing the 'ptype /o' work, I noticed that 'c_type_print_base' was very long, with a big amount of code just to handle the case of TYPE_CODE_{STRUCT,UNION}. This made working with the function a bit difficult, specially because of the level of indentation. This commit moves this part of the code to their own functions. Now we have a 'c_type_print_base_struct_union' with most of the code, and also 'need_access_label_p', which is a subset of the code that was also a good candidate for having its own function. gdb/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> * c-typeprint.c (need_access_label_p): New function. (c_type_print_base_struct_union): New function. (c_type_print_base): Move code to handle TYPE_CODE_{STRUCT,UNION} to the functions mentioned above.
2017-12-15Update documentation regarding the bfd returned by bfd_openr_next_archived_fileNick Clifton2-4/+12
PR 22571 * archive.c (bfd_openr_next_archived_file): Extend the documentation to note that it is necessary to call bfd_check_format on the rrturned bfd before using it.
2017-12-15Fix PR19061, gdb hangs/spins-on-cpu when debugging any program on AlphaRichard Henderson3-6/+28
This fixes PR19061, where gdb hangs/spins-on-cpu when debugging any program on Alpha. (This patch is Uros' forward port of the patch from comment #5 of the PR [1].) Patch was tested on alphaev68-linux-gnu, also tested with gcc's testsuite, where it fixed all hangs in guality.exp and simulate-thread.exp testcases. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=19061#c5 gdb/ChangeLog: 2017-12-15 Richard Henderson <rth@redhat.com> Uros Bizjak <ubizjak@gmail.com> PR gdb/19061 * alpha-tdep.c (alpha_software_single_step): Call alpha_deal_with_atomic_sequence here. (set_gdbarch_software_single_step): Set to alpha_software_single_step. * nat/linux-ptrace.h [__alpha__]: Define GDB_ARCH_IS_TRAP_BRKPT and GDB_ARCH_IS_TRAP_HWBKPT.
2017-12-15Skip 'maintenance check xml-descriptions' if XML is disabledYao Qi2-1/+8
I see the following test failure when gdb is configured without XML support, maintenance check xml-descriptions binutils-gdb/gdb/testsuite/../features warning: Can not parse XML target description; XML support was disabled at compile time^M Tested 29 XML files, 29 failed (gdb) FAIL: gdb.gdb/unittest.exp: maintenance check xml-descriptions ${srcdir}/../features gdb/testsuite: 2017-12-15 Yao Qi <yao.qi@linaro.org> * gdb.gdb/unittest.exp: Skip 'maintenance check xml-descriptions' if XML is disabled.