aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-03-26Re: i386msdos uninitialised readAlan Modra2-1/+5
Another fix. * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
2020-03-26Re: ARC: Use of uninitialised valueAlan Modra2-2/+6
git commit beea5cc1bc fixed one use of an uninitialised value but ignored another one a few lines later. * arc-dis.c (find_format): Init needs_limm. Simplify use of limm.
2020-03-26alpha-vms: Sanity check ETIR__C_CTL_DFLOC indexAlan Modra2-9/+23
I doubt anyone will want to create more than 16M debug location entries. If there is no bound the object format allows for 32-bit indices and of course fuzzers find that and attempt allocation of up to a 16G byte array. The patch also fixes potential integer overflows in calculating the array size. * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets array. (_bfd_vms_slurp_object_records): Rename "err" to "ok".
2020-03-26Automatic date update in version.inGDB Administrator1-1/+1
2020-03-25Fix error message in compile-object-load.cTom Tromey2-1/+6
I noticed that an error message in compile-object-load.c mentions the wrong symbol name. The loop just above the error is looking for COMPILE_I_EXPR_VAL, but the error references COMPILE_I_EXPR_PTR_TYPE. I'm checking this in as obvious. I don't have a test case -- I noticed it because another patch I'm working on caused this error to be thrown, but that was due to regression in my patch. gdb/ChangeLog 2020-03-25 Tom Tromey <tom@tromey.com> * compile/compile-object-load.c (get_out_value_type): Mention correct symbol name in error message.
2020-03-25Fix WOW64 process system DLL pathsHannes Domani2-3/+45
GetModuleFileNameEx returns for some DLLs of WOW64 processes the path inside the 64bit system directory instead of the 32bit syswow64 directory. Problem happens e.g. with dbghelp.dll: (gdb) start Temporary breakpoint 1 at 0x415a00: file fiber.cpp, line 430. Starting program: C:\src\tests\fiber.exe warning: `C:\Windows\system32\dbghelp.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386. Temporary breakpoint 1, main () at fiber.cpp:430 430 { (gdb) info sharedlibrary From To Syms Read Shared Object Library 0x77070000 0x771d4d20 Yes (*) C:\Windows\SysWOW64\ntdll.dll 0x74dc0000 0x74ebad9c Yes (*) C:\Windows\syswow64\kernel32.dll 0x75341000 0x75386a18 Yes (*) C:\Windows\syswow64\KernelBase.dll 0x6f6a1000 0x6f7c48fc Yes (*) C:\Windows\system32\dbghelp.dll 0x74d01000 0x74dab2c4 Yes (*) C:\Windows\syswow64\msvcrt.dll (*): Shared library is missing debugging information. This detects this situation and converts the DLL path to the syswow64 equivalent. gdb/ChangeLog: 2020-03-25 Hannes Domani <ssbssa@yahoo.de> * windows-nat.c (windows_add_all_dlls): Fix system dll paths.
2020-03-25readelf looping in process_archiveAlan Modra2-2/+8
With a crafted "negative" ar_hdr.ar_size it is possible to make readelf loop. This patch catches the overflow in a file offset calculation. * readelf.c (process_archive): Prevent endless loop.
2020-03-25Add a new function to the BFD library to allow users access to the COFF ↵Nick Clifton4-0/+26
internal_extra_pe_outhdr structure. * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New function. * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype. * libbfd.h: Regenerate.
2020-03-25The "b" flag for COFF sections only unsets the LOAD attribute. It should ↵J.W. Jagersma2-0/+10
also clear the CONTENTS attribute so that named bss sections don't take up space in an object file. This can be achieved by setting the 'bss' flag in seg_info. * config/obj-coff.c (obj_coff_section): Set the bss flag on sections with the "b" attribute.
2020-03-25[gdb] Print user/includes fields for maint commandsTom de Vries3-3/+64
The type struct compunit_symtab contains two fields (disregarding field next) that express relations with other compunit_symtabs: user and includes. These fields are currently not printed with "maint info symtabs" and "maint print symbols". Fix this such that for "maint info symtabs" we print: ... { ((struct compunit_symtab *) 0x23e8450) debugformat DWARF 2 producer (null) dirname (null) blockvector ((struct blockvector *) 0x23e8590) + user ((struct compunit_symtab *) 0x2336280) + ( includes + ((struct compunit_symtab *) 0x23e85e0) + ((struct compunit_symtab *) 0x23e8960) + ) { symtab <unknown> ((struct symtab *) 0x23e85b0) fullname (null) linetable ((struct linetable *) 0x0) } } ... And for "maint print symbols" we print: ... -Symtab for file <unknown> +Symtab for file <unknown> at 0x23e85b0 Read from object file /data/gdb_versions/devel/a.out (0x233ccf0) Language: c Blockvector: block #000, object at 0x23e8530, 0 syms/buckets in 0x0..0x0 block #001, object at 0x23e84d0 under 0x23e8530, 0 syms/buckets in 0x0..0x0 +Compunit user: 0x2336300 +Compunit include: 0x23e8900 +Compunit include: 0x23dd970 ... Note: for user and includes we don't list the actual compunit_symtab address, but instead the corresponding symtab address, which allows us to find that symtab elsewhere in the output (given that we also now print the address of symtabs). gdb/ChangeLog: 2020-03-25 Tom de Vries <tdevries@suse.de> * symtab.h (is_main_symtab_of_compunit_symtab): New function. * symmisc.c (dump_symtab_1): Print user and includes fields. (maintenance_info_symtabs): Same.
2020-03-25gdb/riscv: Apply NaN boxing when writing return values into registersAndrew Burgess2-29/+48
When setting up function parameters we already perform NaN boxing, as required by the RISC-V ABI, however, we don't do this when writing values into registers as part of setting up a return value. This commit moves the NaN boxing code into a small helper function, and then makes use of this function when setting up function parameters, and also when setting up return values. This should resolve this failure: FAIL: gdb.base/return-nodebug.exp: float: full width of the returned result gdb/ChangeLog: PR gdb/25489 * riscv-tdep.c (riscv_arg_info::c_offset): Update comment. (riscv_regcache_cooked_write): New function. (riscv_push_dummy_call): Use new function. (riscv_return_value): Likewise.
2020-03-25arc: Use correct string when printing bfd DEBUG dataShahab Vahedi2-2/+7
PRINT_DEBUG_RELOC_INFO_BEFORE() macro prints bunch of parameters for debugging purposes. Due to a seemingly copy/paste mistake, the "input_section->vma" is printed under the field name "symbol_section->vma". This commit fixes that. This fix is a courtesy of xiangzhai. * elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the correct field name in the output string.
2020-03-25h8300-linux ld testsuiteAlan Modra90-42/+203
This fixes lots of fails caused by h8300-linux not supporting -shared and related options. I've also fixed ld-h8300 tests to accept the valid h8300-linux -m options . pr22450.d is also fixed for avr, crx, ip2k, m68hc11 and xc16x, and the new pr25708 test for hppa64. * testsuite/ld-elf/compress1c.d: xfail h8300. * testsuite/ld-elf/compressed1c.d: Likewise. * testsuite/ld-elf/compressed1e.d: Likewise. * testsuite/ld-elf/dynamic1.d: Likewise. * testsuite/ld-elf/dynsym1.d: Likewise. * testsuite/ld-elf/ehdr_start-shared.d: Likewise. * testsuite/ld-elf/exclude3b.d: Likewise. * testsuite/ld-elf/export-class.exp: Don't run without -shared support. * testsuite/ld-elf/global1.d: xfail h8300. * testsuite/ld-elf/hash.d: Likewise. * testsuite/ld-elf/loadaddr1.d: Likewise. * testsuite/ld-elf/loadaddr2.d: Likewise. * testsuite/ld-elf/local1.d: Likewise. * testsuite/ld-elf/mbind1b.d: Likewise. * testsuite/ld-elf/mbind1c.d: Likewise. * testsuite/ld-elf/now-1.d: Likewise. * testsuite/ld-elf/now-2.d: Likewise. * testsuite/ld-elf/now-3.d: Likewise. * testsuite/ld-elf/now-4.d: Likewise. * testsuite/ld-elf/pie.d: Likewise. * testsuite/ld-elf/pr12975.d: Likewise. * testsuite/ld-elf/pr13177.d: Likewise. * testsuite/ld-elf/pr13195.d: Likewise. * testsuite/ld-elf/pr16322.d: Likewise. * testsuite/ld-elf/pr16498a.d: Likewise. * testsuite/ld-elf/pr16498b.d: Likewise. * testsuite/ld-elf/pr17615.d: Likewise. * testsuite/ld-elf/pr19162.d: Likewise. * testsuite/ld-elf/pr19539.d: Likewise. * testsuite/ld-elf/pr19617a.d: Likewise. * testsuite/ld-elf/pr19698.d: Likewise. * testsuite/ld-elf/pr20513c.d: Likewise. * testsuite/ld-elf/pr20513d.d: Likewise. * testsuite/ld-elf/pr21389a.d: Likewise. * testsuite/ld-elf/pr21389b.d: Likewise. * testsuite/ld-elf/pr21389c.d: Likewise. * testsuite/ld-elf/pr21562a.d: Likewise. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/pr21903a.d: Likewise. * testsuite/ld-elf/pr21903b.d: Likewise. * testsuite/ld-elf/pr21903d.d: Likewise. * testsuite/ld-elf/pr22269a.d: Likewise. * testsuite/ld-elf/pr22269b.d: Likewise. * testsuite/ld-elf/pr22393-1a.d: Likewise. * testsuite/ld-elf/pr22393-1b.d: Likewise. * testsuite/ld-elf/pr22393-1c.d: Likewise. * testsuite/ld-elf/pr22393-1d.d: Likewise. * testsuite/ld-elf/pr22393-1e.d: Likewise. * testsuite/ld-elf/pr22393-1f.d: Likewise. * testsuite/ld-elf/pr22423.d: Likewise. * testsuite/ld-elf/pr22450.d: xfail avr, crx, h8300, ip2k, m68hc11, and xc16x. * testsuite/ld-elf/pr23658-1c.d: xfail h8300. * testsuite/ld-elf/pr25708.d: xfail h8300 and hppa64. * testsuite/ld-elf/rpath-1.d: xfail h8300. * testsuite/ld-elf/rpath-2.d: Likewise. * testsuite/ld-elf/runpath-1.d: Likewise. * testsuite/ld-elf/runpath-2.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-elf/strtab.d: Likewise. * testsuite/ld-elf/textaddr1.d: Likewise. * testsuite/ld-elf/textaddr2.d: Likewise. * testsuite/ld-elf/textaddr4.d: Likewise. * testsuite/ld-elf/textaddr5.d: Likewise. * testsuite/ld-elf/textaddr6.d: Likewise. * testsuite/ld-elf/unknown2.d: Likewise. * testsuite/ld-undefined/entry-3.d: Likewise. * testsuite/ld-undefined/entry-4.d: Likewise. * testsuite/ld-h8300/h8300.exp: Pass appropriate ld -m option. * testsuite/ld-h8300/gcsection.d: Remove ld -m option and relax file format match. * testsuite/ld-h8300/relax-2.d: Likewise. * testsuite/ld-h8300/relax-3.d: Likewise. * testsuite/ld-h8300/relax-4.d: Likewise. * testsuite/ld-h8300/relax-5.d: Likewise. * testsuite/ld-h8300/relax-6.d: Likewise. * testsuite/ld-h8300/relax-7.d: Likewise. * testsuite/ld-h8300/relax.d: Relax file format match.
2020-03-25PR25662, invalid sh_offset for first section in segment with phdrsAlan Modra2-3/+25
PR 25662 * elf.c (assign_file_positions_for_load_sections): Adjust offset for SHT_NOBITS section if first in segment.
2020-03-25Automatic date update in version.inGDB Administrator1-1/+1
2020-03-24bfd: Add a bfd_boolean argument to bfd_get_symbol_version_stringH.J. Lu11-25/+43
We can't call _bfd_elf_get_symbol_version_name from nm.c since it isn't available for all target configurations. This patch add a bfd_boolean argument to bfd_get_symbol_version_string instead. bfd/ PR binutils/25708 * elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ... (_bfd_elf_get_symbol_version_string): This. * elf.c (_bfd_elf_get_symbol_version_name): Renamed to ... (_bfd_elf_get_symbol_version_string): This. (bfd_elf_print_symbol): Pass TRUE to _bfd_elf_get_symbol_version_string. * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a bfd_boolean argument. * syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise. * targets.c (_bfd_get_symbol_version_string): Likewise. (bfd_get_symbol_version_string): Likewise. * bfd-in2.h: Regenerated. binutils/ PR binutils/25708 * nm.c (print_symname): Replace _bfd_elf_get_symbol_version_name with bfd_get_symbol_version_string. (print_symbo): Pass TRUE to bfd_get_symbol_version_string. * objdump.c (objdump_print_symname): Likewise.
2020-03-25Uninitialised memory read in z80-dis.cAlan Modra2-0/+5
objdump -d -m ez80-adl testcase: .byte 0x40,0xfd * z80-dis.c (suffix): Init mybuf.
2020-03-24gdb: bool-ify follow_forkSimon Marchi12-53/+64
Change parameters and return value of the various follow_fork functions/methods from int to bool. gdb/ChangeLog: * fbsd-nat.c (fbsd_nat_target::follow_fork): Change bool to int. * fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Likewise. * inf-ptrace.c (inf_ptrace_target::follow_fork): Likewise. * inf-ptrace.h (struct inf_ptrace_target) <follow_fork>: Likewise. * infrun.c (follow_fork): Likewise. (follow_fork_inferior): Likewise. * linux-nat.c (linux_nat_target::follow_fork): Likewise. * linux-nat.h (class linux_nat_target): Likewise. * remote.c (class remote_target) <follow_fork>: Likewise. (remote_target::follow_fork): Likewise. * target-delegates.c: Re-generate. * target.c (default_follow_fork): Likewise. (target_follow_fork): Likewise. * target.h (struct target_ops) <follow_fork>: Likewise. (target_follow_fork): Likewise.
2020-03-24Update changelog.Nick Clifton1-0/+1
2020-03-24Add code to the BFD library to handle opening files with pathnames longer ↵Nick Clifton2-11/+31
than MAX_PATH on Win32 systems. PR 25713 * bfdio.c (_bfd_real_fopen): Add code to handle long filenames on Win32 systems.
2020-03-24Fix assertion failure in the BFD library when linking with --emit-relocs ↵Nick Clifton2-3/+13
enabled. PR 25681 * elf.c (_bfd_elf_map_sections_to_segments): When looking for a segment to use for PT_GNU_RELRO, ignore empty sections in a segment's current list.
2020-03-24bfd: Change num_group to unsigned intH.J. Lu2-1/+6
elf.c failed with to with GCC 10 as of commit 906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536 Author: Martin Liska <mliska@suse.cz> Date: Tue Mar 24 11:40:10 2020 +0100 Improve endianess detection. PR lto/94249 * plugin-api.h: Add more robust endianess detection. binutils-gdb/bfd/elf.c: In function ‘setup_group’: binutils-gdb/bfd/elf.c:740:35: error: overflow in conversion from ‘unsigned int’ to ‘int’ changes value from ‘num_group = 4294967295’ to ‘-1’ [-Werror=overflow] 740 | elf_tdata (abfd)->num_group = num_group = -1; | ^~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:1608: elf.lo] Error 1 Change num_group in elf_obj_tdata to unsigned int to compile with GCC 10. PR binutils/25717 * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
2020-03-24include: Sync plugin-api.h with GCCMartin Liska2-2/+68
Improve endianess detection. PR lto/94249 * plugin-api.h: Add more robust endianess detection.
2020-03-24bfd: Display symbol version for nm -DH.J. Lu7-12/+77
Extend _bfd_elf_get_symbol_version_string for nm -D to display symbol version. _bfd_elf_get_symbol_version_name is added to avoid updating all XXX_get_symbol_version_string functions. bfd/ PR binutils/25708 * elf-bfd.h (_bfd_elf_get_symbol_version_name): New. * elf.c (_bfd_elf_get_symbol_version_name): New function. Based on the previous _bfd_elf_get_symbol_version_string. (_bfd_elf_get_symbol_version_string): Use it. binutils/ PR binutils/25708 * nm.c (SYM_NAME): Removed. (print_symname): Add a pointer to struct extended_symbol_info argument. Call _bfd_elf_get_symbol_version_name to get symbol version. (print_symdef_entry): Pass NULL to print_symname. (print_symbol_info_bsd): Update call to print_symname. (print_symbol_info_sysv): Likewise. (print_symbol_info_posix): Likewise. ld/ PR binutils/25708 * testsuite/ld-elf/pr25708.d: New file.
2020-03-24[gdb] Print user for maint info psymtabsTom de Vries2-0/+9
The type struct partial_symtab contains two fields (disregarding field next) that express relations with other symtabs: user and dependencies. When using "maint print psymbols", we see both the dependencies and the user fields: ... Partial symtab for source file (object 0x35ef270) ... Depends on 0 other partial symtabs. Shared partial symtab with user 0x35d5f40 ... But with "maint info psymtabs", we only see dependencies: ... { psymtab ((struct partial_symtab *) 0x35ef270) ... dependencies (none) } ... Add printing of the user field for "maint info psymtabs", such that we have: ... { psymtab ((struct partial_symtab *) 0x35ef270) ... + user hello.c ((struct partial_symtab *) 0x35d5f40) dependencies (none) } ... Tested on x86_64-linux. gdb/ChangeLog: 2020-03-24 Tom de Vries <tdevries@suse.de> * psymtab.c (maintenance_info_psymtabs): Print user field.
2020-03-24Overlarge allocation in _bfd_generic_read_ar_hdr_magAlan Modra2-3/+18
* archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended name size. Use bfd_malloc rather than bfd_zmalloc, clearing just struct areltdata.
2020-03-24readelf memory leak in process_mips_specificAlan Modra2-2/+12
* readelf.c (process_mips_specific): Free iconf on error path.
2020-03-24Automatic date update in version.inGDB Administrator1-1/+1
2020-03-23Avoid trigger an assertion failure in the STABS parser by replacing the ↵Nick Clifton2-18/+59
abort with an error return. PR 25714 * wrstabs.c (stab_pop_type): Replace assertion with error return. * write_stabs_in_sections_debugging_info: Likewise. * stab_enum_type: Likewise. * stab_modify_type: Likewise. * stab_struct_field: Likewise. * stab_end_struct_type: Likewise. * stab_start_class_type: Likewise. * stab_class_static_member: Likewise. * stab_class_baseclass: Likewise. * stab_class_start_method: Likewise. * stab_class_method_var: Likewise. * stab_class_end_method: Likewise. * stab_end_class_type: Likewise. * stab_typedef_type: Likewise. * stab_start_function: Likewise. * stab_end_block: Likewise. * stab_lineno: Likewise.
2020-03-23Mention .tdata in comment in _bfd_elf_tls_setup()Sebastian Huber2-2/+6
This helps to find code areas which deal with the .tdata section. bfd/ * elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
2020-03-23ECOFF archive uninitialised readAlan Modra2-10/+32
* ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and symbol count. Allocate an extra byte to ensure name strings are terminated. Sanity check name offsets. Release memory on error return.
2020-03-23i386msdos uninitialised readAlan Modra6-6/+26
Also reinstate ld i386aout for i386-msdos target, which doesn't build otherwise. bfd/ * i386msdos.c (msdos_object_p): Don't access e_lfanew when that field hasn't been read. Remove unnecessary casts. ld/ * Makefile.am (ALL_EMULATION_SOURCES): Reinstate ei386aout.c. Include ei386aout dep file. * Makefile.in: Regenerate. * po/BLD-POTFILES.in: Regenerate.
2020-03-23gdb/testsuite: Remove hard coded addresses from expected resultsAndrew Burgess2-2/+7
In commit: commit 6b8c53f2f1c0cf5bee46120d892d4c72571375eb Date: Sat Feb 8 21:26:31 2020 +0000 gdb/testsuite/fortran: Add mixed language stack test The test incorrectly included two hard coded addresses in the expected output, this commit replaces them with the $hex pattern. gdb/testsuite/ChangeLog: * gdb.fortran/mixed-lang-stack.exp: Replace two hard coded address with $hex.
2020-03-23Automatic date update in version.inGDB Administrator1-1/+1
2020-03-22XCOFF64 uninitialised readAlan Modra2-2/+7
Like git commit 67338173a4. * coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large enough to read number of symbols.
2020-03-22H8300 use of uninitialised valueAlan Modra2-6/+33
* h8300-dis.c (bfd_h8_disassemble): Limit data[] access to that successflly read from section.
2020-03-22ARC: Use of uninitialised valueAlan Modra2-3/+10
* arc-dis.c (find_format): Use ISO C string concatenation rather than line continuation within a string. Don't access needs_limm before testing opcode != NULL.
2020-03-22NS32K arg_bufs uninitialisedAlan Modra2-9/+17
git commit d1e304bc27 was aimed at stopping uninitialised memory access to the index_offset array. Unfortunately that patch resulted in a different array being uninitialised for all instructions with more than two arguments. * ns32k-dis.c (print_insn_arg): Update comment. (print_insn_ns32k): Reduce size of index_offset array, and initialize, passing -1 to print_insn_arg for args that are not an index. Don't exit arg loop early. Abort on bad arg number.
2020-03-22s12z disassembler tidyAlan Modra5-320/+765
Don't ignore buffer memory read failure, or malloc failure. Lots of functions get a return status to pass these failures up the chain in this patch. opcodes/ * s12z-dis.c (abstract_read_memory): Don't print error on EOI. * s12z-opc.c: Formatting. (operands_f): Return an int. (opr_n_bytes_p1): Return -1 on reaching buffer memory limit. (opr_n_bytes2, bfextins_n_bytes, mul_n_bytes, bm_n_bytes), (shift_n_bytes, mov_imm_opr_n_bytes, loop_prim_n_bytes), (exg_sex_discrim): Likewise. (create_immediate_operand, create_bitfield_operand), (create_register_operand_with_size, create_register_all_operand), (create_register_all16_operand, create_simple_memory_operand), (create_memory_operand, create_memory_auto_operand): Don't segfault on malloc failure. (z_ext24_decode): Return an int status, negative on fail, zero on success. (x_imm1, imm1_decode, trap_decode, z_opr_decode, z_opr_decode2), (imm1234, reg_s_imm, reg_s_opr, z_imm1234_8base, z_imm1234_0base), (z_tfr, z_reg, reg_xy, lea_reg_xys_opr, lea_reg_xys, rel_15_7), (decode_rel_15_7, cmp_xy, sub_d6_x_y, sub_d6_y_x), (ld_18bit_decode, mul_decode, bm_decode, bm_rel_decode), (mov_imm_opr, ld_18bit_decode, exg_sex_decode), (loop_primitive_decode, shift_decode, psh_pul_decode), (bit_field_decode): Similarly. (z_decode_signed_value, decode_signed_value): Similarly. Add arg to return value, update callers. (x_opr_decode_with_size): Check all reads, returning NULL on fail. Don't segfault on NULL operand. (decode_operation): Return OP_INVALID on first fail. (decode_s12z): Check all reads, returning -1 on fail. gas/ * testsuite/gas/s12z/truncated.d: Update expected output.
2020-03-22Automatic date update in version.inGDB Administrator1-1/+1
2020-03-21include: Sync lto-symtab.h and plugin-api.h with GCCMartin Liska3-2/+8
Fix comma at end of enumerator list seen with -std=c++98. * plugin-api.h (enum ld_plugin_symbol_type): Remove comma after last value of an enum. * lto-symtab.h (enum gcc_plugin_symbol_type): Likewise.
2020-03-21Automatic date update in version.inGDB Administrator1-1/+1
2020-03-20Make dwarf2_evaluate_property parameter constTom Tromey3-3/+10
dwarf2_evaluate_property should not modify its "addr_stack" parameter's contents. This patch makes this part of the API, by marking it const. gdb/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * dwarf2/loc.h (dwarf2_evaluate_property): Make "addr_stack" const. * dwarf2/loc.c (dwarf2_evaluate_property): Make "addr_stack" const.
2020-03-20[gdb/testsuite] Fix gdb.threads/omp-par-scope.exp XPASSTom de Vries2-1/+27
When running test-case gdb.threads/omp-par-scope.exp, I get this XPASS: ... XPASS: gdb.threads/omp-par-scope.exp: nested_parallel: outer_threads: \ outer stop: get valueof "num" ... for test: ... set thread_num [get_valueof "" "num" "unknown"] ... The intention of the test is to get the value of local variable num, which has been set to: ... int num = omp_get_thread_num (); ... but the actually printed value is 'num': ... (gdb) print num^M $76 = num^M ... This is due to the fact that num is missing in the locals, so instead we find the enum member 'num' of enum expression_operator in glibc/intl/plural-exp.h. Fix this by getting the value using a new proc get_local_valueof, which uses the "info locals" commands to get the value. Tested on x86_64-linux, with gcc 7.5.0 (where the test xfails) and gcc 10.0.1 (where the test passes).
2020-03-20gdb: remove HAVE_DECL_PTRACESimon Marchi11-85/+19
I stumbled on this snippet in nat/gdb_ptrace.h: /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64 or whatever it's called these days, don't provide a prototype for ptrace. Provide one to silence compiler warnings. */ #ifndef HAVE_DECL_PTRACE extern PTRACE_TYPE_RET ptrace(); #endif I believe this is unnecessary today and should be removed. First, the comment only mentions OSes we don't support (and to be honest, I had never even heard of). But most importantly, in C++, a declaration with empty parenthesis declares a function that accepts no arguments, unlike in C. So if this declaration was really used, GDB wouldn't build, since all ptrace call sites pass some arguments. Since we haven't heard anything about this causing some build failures since we have transitioned to C++, I conclude that it's not used. This patch removes it as well as the corresponding configure check. gdb/ChangeLog: * ptrace.m4: Don't check for ptrace declaration. * config.in: Re-generate. * configure: Re-generate. * nat/gdb_ptrace.h: Don't declare ptrace if HAVE_DECL_PTRACE is not defined. gdbserver/ChangeLog: * config.in: Re-generate. * configure: Re-generate. gdbsupport/ChangeLog: * config.in: Re-generate. * configure: Re-generate.
2020-03-20Update the return type of gdb_ptrace to be more flexibleKamil Rytarowski5-4/+12
Linux returns long from ptrace(2) and BSDs int. gdb/ChangeLog: * amd64-bsd-nat.c (gdb_ptrace): Change return type from `int' to `PTRACE_TYPE_RET'. * i386-bsd-nat.c (gdb_ptrace): Likewise. * sparc-nat.c (gdb_ptrace): Likewise. * x86-bsd-nat.c (gdb_ptrace): Likewise.
2020-03-20Fix assert in c-exp.yTom Tromey2-1/+5
The "restrict" patch added some asserts to c-exp.y, but one spot was copy-pasted and referred to the wrong table. This was pointed out by -fsanitize=address. This patch fixes the bug. gdb/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * c-exp.y (lex_one_token): Fix assert.
2020-03-20Avoid stringop-truncation errorsTom Tromey3-3/+10
I configured with -fsanitize=address and built gdb. linux-tdep.c and ada-tasks.c failed to build due to some stringop-truncation errors, e.g.: In function ‘char* strncpy(char*, const char*, size_t)’, inlined from ‘int linux_fill_prpsinfo(elf_internal_linux_prpsinfo*)’ at ../../binutils-gdb/gdb/linux-tdep.c:1742:11, inlined from ‘char* linux_make_corefile_notes(gdbarch*, bfd*, int*)’ at ../../binutils-gdb/gdb/linux-tdep.c:1878:27: /usr/include/bits/string_fortified.h:106:34: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 81 equals destination size [-Werror=stringop-truncation] This patch fixes the problem by using "sizeof - 1" in the call to strndup, as recommended in the GCC manual. This doesn't make a difference here because the next line, in all cases, sets the final element to '\0' anyway. gdb/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * ada-tasks.c (read_atcb): Use smaller length in strncpy call. * linux-tdep.c (linux_fill_prpsinfo): Use smaller length in strncpy call.
2020-03-20Fix column alignment in "maint info line-table"Tom Tromey4-15/+28
Andrew Burgess pointed out on irc that "maint info line-table" doesn't properly align the table headers. This patch fixes the problem by switching the table to use ui-out. This required a small tweak to one test case, as ui-out will pad a field using spaces, even at the end of a line. gdb/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * symmisc.c (maintenance_print_one_line_table): Use ui_out. gdb/testsuite/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * gdb.dwarf2/dw2-ranges-base.exp: Update regular expressions.
2020-03-20Fix Ada val_print removal regressionTom Tromey5-60/+131
The removal of val_print caused a regression in the Ada code. In one scenario, a variant type would not be properly printed, because the address of a component was lost. This patch fixes the bug by changing this API to be value-based. This is cleaner and fixes the bug as a side effect. gdb/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * ada-valprint.c (print_variant_part): Remove parameters; switch to value-based API. (print_field_values): Likewise. (ada_val_print_struct_union): Likewise. (ada_value_print_1): Update. gdb/testsuite/ChangeLog 2020-03-20 Tom Tromey <tromey@adacore.com> * gdb.ada/sub_variant/subv.adb: New file. * gdb.ada/sub_variant.exp: New file.