aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-11-29Fix Value.format_string docu for static members argumentHannes Domani2-1/+6
The argument is called static_members, not static_fields. gdb/doc/ChangeLog: 2020-11-29 Hannes Domani <ssbssa@yahoo.de> PR python/26974 * python.texi: Fix docu for static members argument.
2020-11-29Don't delete the locator win infoHannes Domani2-1/+9
The locator win info is special because it is static, all the others are created dynamically. gdb/ChangeLog: 2020-11-29 Hannes Domani <ssbssa@yahoo.de> PR tui/26973 * tui/tui-layout.c (tui_apply_current_layout): Don't delete the static locator win info.
2020-11-29x86: Do not dump DS/CS segment overrides for branch hintsBorislav Petkov9-2/+50
The previous change "x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode" to ignore segment override prefixes in 64-bit mode lead to dumping branch hints as excessive prefixes: ffffffff8109d5a0 <vmx_get_rflags>: ... ffffffff8109d601: 3e 77 0a ds ja,pt ffffffff8109d60e <vmx_get_rflags+0x6e> ^^^^^ In this particular case, those prefixes are not excessive but are used to provide branch hints - taken/not-taken - to the CPU. Assign active_seg_prefix in that particular case to consume them. gas/ 2002-11-29 Borislav Petkov <bp@suse.de> * testsuite/gas/i386/branch.d: Add new branch insns test. * testsuite/gas/i386/branch.s: Likewise. * testsuite/gas/i386/i386.exp: Insert the new branch test. * testsuite/gas/i386/x86-64-branch.d: Test for branch hints insns. * testsuite/gas/i386/x86-64-branch.s: Likewise. * testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise. opcodes/ 2020-11-28 Borislav Petkov <bp@suse.de> * i386-dis.c (print_insn): Set active_seg_prefix for branch hint insns to not dump branch hint prefixes 0x2E and 0x3E as unused prefixes.
2020-11-29gold: Convert x86-64 GOTPCRELX only if addend == -4H.J. Lu6-52/+135
Convert x86-64 GOTPCRELX relocations only if addend == -4. PR gold/26939 * x86_64.cc (Target_x86_64<size>::Scan::local): Check get_r_addend() == -4 for GOTPCRELX conversion. (Target_x86_64<size>::Scan::global): Likewise. (Target_x86_64<size>::Relocate::relocate): Likewise. * testsuite/Makefile.am (check_DATA): Add x86_64_mov_to_lea15.stdout and x86_64_mov_to_lea16.stdout. (MOSTLYCLEANFILES): Add x86_64_mov_to_lea15 and x86_64_mov_to_lea16. (x86_64_mov_to_lea9.o): New target. (x86_64_mov_to_lea10.o): Likewise. (x86_64_mov_to_lea15): Likewise. (x86_64_mov_to_lea16): Likewise. (x86_64_mov_to_lea15.stdout): Likewise. (x86_64_mov_to_lea16.stdout): Likewise. * testsuite/Makefile.in: Regenerated. * testsuite/x86_64_mov_to_lea.sh: Updated. * testsuite/x86_64_mov_to_lea5.s: New file.
2020-11-29gold: Get linkonce/comdate sections for debugging sectionsH.J. Lu9-7/+166
When relocating debug sections, get the section index for the linkonce section. Since symbols referenced in debugging sections can be defined a single comdat section with a different section name, also check the single comdat section. PR gold/26937 * object.cc (Sized_relobj_file::map_to_kept_section): Get the section index for linkonce section. Also check the single comdat section. * testsuite/Makefile.am (check_SCRIPTS): Add pr26936.sh. (check_DATA): Add pr26936a.stdout and pr26936b.stdout. (MOSTLYCLEANFILES): Add pr26936a and pr26936b. (pr26936a.stdout): New target. (pr26936a): Likewise. (pr26936b.stdout): Likewise. (pr26936b): Likewise. (pr26936a.o): Likewise. (pr26936b.o): Likewise. (pr26936c.o): Likewise. (pr26936d.o): Likewise. * testsuite/Makefile.in: Regenerated. * testsuite/pr26936.sh: New file. * testsuite/pr26936a.s: Likewise. * testsuite/pr26936b.s: Likewise. * testsuite/pr26936c.s: Likewise. * testsuite/pr26936d.s: Likewise.
2020-11-29Automatic date update in version.inGDB Administrator1-1/+1
2020-11-28GDB: Fix detection of ELF support when configuring with ↵Alex Richardson3-0/+8
-Werror=implicit-function-declaration I am getting I'm sorry, Dave, I can't do that. Symbol format `elf64-littleriscv' unknown. errors after updating from GDB 8.3 to 10. Bisecting showed that since commit 1ff6de031241 ("bfd, ld: add CTF section linking"), bfd.h depends on strncmp() being present, so configuring with -Werror=implicit-function-declaration results in the check for ELF support in BFD failing: .../gdb/gdb/../bfd/elf-bfd.h: In function 'bfd_section_is_ctf': .../gdb/gdb/../bfd/elf-bfd.h:3086:10: error: implicit declaration of function 'strncmp' [-Werror=implicit-function-declaration] return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.'); gdb/ChangeLog: * acincludde.m4 (GDB_AC_CHECK_BFD): Include string.h in the test program. Change-Id: Iec5e21d454c2a544c44d65e23cfde552c424c18e
2020-11-28PR26907, segment contains empty SHT_NOBITS sectionAlan Modra6-1/+39
Section ordering is important for _bfd_elf_map_sections_to_segments and assign_file_positions_for_load_sections, which are only prepared to handle sections in increasing LMA order. When zero size sections are involved it is possible to have multiple sections at the same LMA. In that case the zero size sections must sort before any non-zero size sections regardless of their types. bfd/ PR 26907 * elf.c (elf_sort_sections): Don't sort zero size !load sections after load sections. ld/ * testsuite/ld-elf/pr26907.ld, * testsuite/ld-elf/pr26907.s, * testsuite/ld-elf/pr26907.d: New test.
2020-11-28Automatic date update in version.inGDB Administrator1-1/+1
2020-11-27gdb: fix potentially uninitialised variableAndrew Burgess2-7/+23
In commit: commit 037d7135de575c9e0c20e9158c105979bfee339c Date: Mon Nov 16 11:36:56 2020 +0000 gdb: improve command completion for 'print', 'x', and 'display' A potential use of an uninitialised variable was introduced. This is fixed in this commit. Previously when analysing /FMT strings for tab completion we considered two possibilities, either the user has typed '/', or the user has typed '/' followed by an alpha-numeric character, as these are the only valid FMT string characters. This meant that if the user type, for example '/@' and then tried to tab complete gdb would use an uninitialised variable. Currently only the first character after the '/' is checked to see if it is alpha-numeric, so if a user typed '/x@@' then gdb would be happy to treat this as a FMT string. Given the goal of this change was primarily to allow tab completion of symbols later in the command when a /FMT was used then I decided to just make the /FMT skipping less smart. Now any characters after the '/' up to the first white space, will be treated as a FMT string. gdb/ChangeLog: * printcmd.c (skip_over_slash_fmt): Reorder code to ensure in_fmt is always initialized.
2020-11-27Add Rogerio Alves to gdb/MAINTAINERS.Rogerio Alves1-0/+1
gdb/Changelog 2020-11-26 Rogerio Alves <rcardoso@linux.ibm.com> * MAINTAINERS (Write After Approval): Add myself.
2020-11-27Allow spaces in the name of the external preprocessor used by windres.Nick Clifton2-1/+13
PR 26865 * windres.c (main): If the preprocessor name includes spaces, ensure that it is quoted.
2020-11-27ELF: Support .noinit and .persistent sectionsJozef Lawrynowicz25-18/+249
The ".persistent" section is for data that should be initialized during load, but not during application reset. The ".noinit" section is for data that should not be initialized during load or application reset. Targets utilizing the elf.sc linker script template can define HAVE_{NOINIT,PERSISTENT}=yes to include the .noinit or .persistent output sections in the generated linker script. Targets with existing support for .noinit did not handle unique .noinit.* and .gnu.linkonce.n.* sections the .noinit output section, this patch also fixes that. bfd/ChangeLog: * elf.c (special_sections_g): Add .gnu.linkonce.n and .gnu.linkonce.p. (special_sections_n): Add .noinit. (special_sections_p): Add .persistent. binutils/ChangeLog: * testsuite/lib/binutils-common.exp (supports_noinit_section): New. (supports_persistent_section): New. gas/ChangeLog: * testsuite/gas/elf/elf.exp: Run new tests. * testsuite/gas/elf/section25.d: New test. * testsuite/gas/elf/section25.s: New test. * testsuite/gas/elf/section26.d: New test. * testsuite/gas/elf/section26.s: New test. ld/ChangeLog: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .noinit section definition. Define HAVE_{NOINIT,PERSISTENT}=yes. * scripttempl/avr.sc (.noinit): Add .noinit.* and .gnu.linkonce.n.* input section wildcard patterns. * scripttempl/elf.sc: Define .noinit and .persistent sections when HAVE_NOINIT or HAVE_PERSISTENT are defined to "yes". * scripttempl/elf32msp430.sc (.noinit): Add .noinit.* and .gnu.linkonce.n.*. input section wildcard patterns. (.persistent): Add .persistent.* and .gnu.linkonce.p.*. input section wildcard patterns. * scripttempl/elfarcv2.sc (.noinit): Add .noinit.* and .gnu.linkonce.n.*. input section wildcard patterns. * scripttempl/pru.sc: Likewise. * testsuite/ld-elf/noinit-sections-1.d: New test. * testsuite/ld-elf/noinit-sections-2.d: New test. * testsuite/ld-elf/noinit-sections-2.l: New test. * testsuite/ld-elf/noinit-sections.s: New test. * testsuite/ld-elf/persistent-sections-1.d: New test. * testsuite/ld-elf/persistent-sections-2.d: New test. * testsuite/ld-elf/persistent-sections-2.l: New test. * testsuite/ld-elf/persistent-sections.s: New test.
2020-11-27Automatic date update in version.inGDB Administrator1-1/+1
2020-11-26Prevent a memory allocation failure when parsing corrupt DWARF debug sections.Nick Clifton2-6/+25
PR 26946 * dwarf2.c (read_section): Check for debug sections with excessive sizes.
2020-11-26gdb/aarch64: Add named flags for FPCR and FPSR registersPrzemyslaw Wirkus3-4/+108
This patch updates FPCR (Floating-point Control Register) and FPSR (Floating-point Status Register) named fields in AArch64. For detailed description of named register FPCR and FPSR bit fields see [1] and [2]. Please not that bit fields FIZ, AH and NEP (bits 0, 1 and 2 respectively) in FPCR are defined starting from Armv8.7 architecture. [1]: https://developer.arm.com/docs/ddi0595/i/aarch64-system-registers/fpcr [2]: https://developer.arm.com/docs/ddi0595/i/aarch64-system-registers/fpsr Example: >>> info all-registers fpsr fpsr 0x10 [ IXC ] >>> info all-registers fpcr fpcr 0x0 [ RMode=0 ]
2020-11-26PR26936 testsuite fixesAlan Modra3-3/+23
Many targets fail this test due to -z noseparate-code not being supported, or _start not being the proper entry symbol, or "as -g" something other than "generate debug". PR 26936 * testsuite/ld-elf/pr26936.d: Pass --gen-debug to gas rather than -g. Only run when -shared -z options are supported. * testsuite/ld-elf/pr26936b.s: Define more entry symbols.
2020-11-25elf: Get the real kept sectionH.J. Lu7-4/+64
When mixing linkonce and comdat sections, we need to keep searching to get the real kept section. bfd/ PR ld/26936 * elflink.c (_bfd_elf_check_kept_section): Get the real kept section. ld/ PR ld/26936 * testsuite/ld-elf/pr26936.d: New file. * testsuite/ld-elf/pr26936a.s: Likewise. * testsuite/ld-elf/pr26936b.s: Likewise. * testsuite/ld-elf/pr26936c.s: Likewise.
2020-11-26Automatic date update in version.inGDB Administrator1-1/+1
2020-11-25libctf: Pass format argument to asprintfH.J. Lu2-1/+6
libctf/ChangeLog 2020-09-23 H.J. Lu <hongjiu.lu@intel.com> PR libctf/26934 * ctf-dump.c (ctf_dump_objts): Pass format argument to asprintf.
2020-11-25binutils: readelf: support CTF dicts with non-native-endian symtabsNick Alcock2-0/+7
Now we have a way to tell libctf what the endianness of the symtab is, get readelf to use it. (objdump doesn't need to do so, nor does ld, because they both use BFD-aware mechanisms to open CTF dicts, so libctf can automatically figure the symtab endianness out.) binutils/ChangeLog 2020-11-23 Nick Alcock <nick.alcock@oracle.com> * readelf.c (dump_section_as_ctf): Call ctf_arc_symsect_endianness.
2020-11-25libctf, include: support foreign-endianness symtabs with CTFNick Alcock11-56/+197
The CTF symbol lookup machinery added recently has one deficit: it assumes the symtab is in the machine's native endianness. This is always true when the linker is writing out symtabs (because cross linkers byteswap symbols only after libctf has been called on them), but may be untrue in the cross case when the linker or another tool (objdump, etc) is reading them. Unfortunately the easy way to model this to the caller, as an endianness field in the ctf_sect_t, is precluded because doing so would change the size of the ctf_sect_t, which would be an ABI break. So, instead, allow the endianness of the symtab to be set after open time, by calling one of the two new API functions ctf_symsect_endianness (for ctf_dict_t's) or ctf_arc_symsect_endianness (for entire ctf_archive_t's). libctf calls these functions automatically for objects opened via any of the BFD-aware mechanisms (ctf_bfdopen, ctf_bfdopen_ctfsect, ctf_fdopen, ctf_open, or ctf_arc_open), but the various mechanisms that just take raw ctf_sect_t's will assume the symtab is in native endianness and need a later call to ctf_*symsect_endianness to adjust it if needed. (This call is basically free if the endianness is actually native: it only costs anything if the symtab endianness was previously guessed wrong, and there is a symtab, and we are using it directly rather than using symtab indexing.) Obviously, calling ctf_lookup_by_symbol or ctf_symbol_next before the symtab endianness is correctly set will probably give wrong answers -- but you can set it at any time as long as it is before then. include/ChangeLog 2020-11-23 Nick Alcock <nick.alcock@oracle.com> * ctf-api.h: Style nit: remove () on function names in comments. (ctf_sect_t): Mention endianness concerns. (ctf_symsect_endianness): New declaration. (ctf_arc_symsect_endianness): Likewise. libctf/ChangeLog 2020-11-23 Nick Alcock <nick.alcock@oracle.com> * ctf-impl.h (ctf_dict_t) <ctf_symtab_little_endian>: New. (struct ctf_archive_internal) <ctfi_symsect_little_endian>: Likewise. * ctf-create.c (ctf_serialize): Adjust for new field. * ctf-open.c (init_symtab): Note the semantics of repeated calls. (ctf_symsect_endianness): New. (ctf_bufopen_internal): Set ctf_symtab_little_endian suitably for the native endianness. (_Static_assert): Moved... (swap_thing): ... with this... * swap.h: ... to here. * ctf-util.c (ctf_elf32_to_link_sym): Use it, byteswapping the Elf32_Sym if the ctf_symtab_little_endian demands it. (ctf_elf64_to_link_sym): Likewise swap the Elf64_Sym if needed. * ctf-archive.c (ctf_arc_symsect_endianness): New, set the endianness of the symtab used by the dicts in an archive. (ctf_archive_iter_internal): Initialize to unknown (assumed native, do not call ctf_symsect_endianness). (ctf_dict_open_by_offset): Call ctf_symsect_endianness if need be. (ctf_dict_open_internal): Propagate the endianness down. (ctf_dict_open_sections): Likewise. * ctf-open-bfd.c (ctf_bfdopen_ctfsect): Get the endianness from the struct bfd and pass it down to the archive. * libctf.ver: Add ctf_symsect_endianness and ctf_arc_symsect_endianness.
2020-11-25Remove two unnecessary variables from evaluate_subexp_standardTom Tromey2-9/+8
I noticed a couple of spots in evaluate_subexp_standard that looked like: value *result; result = something; return result; This patch simplifies these spots to a simple "return". gdb/ChangeLog 2020-11-25 Tom Tromey <tom@tromey.com> * eval.c (evaluate_subexp_standard): Remove unnecessary variables.
2020-11-25Do not include parser-defs.h from c-lang.hTom Tromey4-1/+8
While working on another series, I noticed that c-lang.h does not need to include parser-defs.h. This patch makes this change, and fixes up the two .c files that needed this include. Tested by rebuilding. gdb/ChangeLog 2020-11-25 Tom Tromey <tom@tromey.com> * d-lang.c: Include parser-defs.h. * rust-lang.c: Include parser-defs.h. * c-lang.h: Do not include parser-defs.h.
2020-11-25Duplicate output sections in scriptsAlan Modra3-42/+45
Previously, ld merged duplicate output sections if such existed in scripts, except for those with a constraint of SPECIAL. This makes scripts with duplicate output section statements create duplicate output sections in the linker output file. * ldlang.c (lang_output_section_statement_lookup): Change "create" parameter to a tristate, if 2 then always create a new output section statement. Update all callers, with lang_enter_output_section_statement using "2". (map_input_to_output_sections): Don't ignore SPECIAL constraint here. * ldlang.h (lang_output_section_statement_type): Update prototype. (lang_output_section_find): Update.
2020-11-25nm ifunc test tweaksAlan Modra2-4/+8
* testsuite/binutils-all/nm.exp (ifunc): xfail more targets.
2020-11-25gas output_file_close error messageAlan Modra3-3/+8
Seen on arm-elf, where ELFOSABI_ARM is set too late to get a warning when processing ifunc related directives on their source line. ../gas/as-new ifunc.s -o tmpdir/ifunc.o ../gas/as-new: symbol type STT_GNU_IFUNC is supported only by GNU and FreeBSD targets ifunc.s: Assembler messages: ifunc.s: Fatal error: can't close tmpdir/ifunc.o: sorry, cannot handle this file This patch doesn't fix the real underlying problem, just the late error message where "can't close" is a misdirection in this case. * output-file.c (output_file_close): Remove "can't close" from error message. * testsuite/gas/mips/reginfo-2.l: Update expected output.
2020-11-25Automatic date update in version.inGDB Administrator1-1/+1
2020-11-24ld/x86-64: Add PR gold/26939 testsH.J. Lu5-0/+40
GOTPCRELX relocations can be transformed only when addend == -4. Add tests for GOTPCRELX relocations with addend != -4. PR gold/26939 * testsuite/ld-x86-64/pr26939-x32.d: New file. * testsuite/ld-x86-64/pr26939.d: Likewise. * testsuite/ld-x86-64/pr26939.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR gold/26939 tests.
2020-11-24gdb: remove struct cached_reg typedefSimon Marchi2-2/+6
Since we are in C++, this typedef is no longer necessary, we can just refer to the struct name directly. gdb/ChangeLog: * regcache.h (struct cached_reg): Remove typedef. Change-Id: I0168b5a9cf88e9b962521760c7e2d0e6f0b52cdf
2020-11-24gdb/testsuite: do not hard-code location indices in condbreak-multi-context.expTankut Baris Aktemur2-67/+128
Breakpoint locations are sorted according to their addresses. The addresses are determined by how the compiler emits the code. Therefore, we may have a different order of locations depending on the compiler we use. To make the gdb.base/condbreak-multi-context.exp test flexible enough for different compilers' output, do not hard-code location indices. Tested with GCC and Clang. gdb/testsuite/ChangeLog: 2020-11-24 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.base/condbreak-multi-context.exp: Do not hard-code location indices.
2020-11-24gdb/README: Fix the URL of the MPFR website (now https).Joel Brobecker2-1/+5
gdb/ChangeLog: * README: Fix the URL of the MPFR library.
2020-11-24gdb/README: Document the --with-libgmp-prefix configure optionJoel Brobecker2-0/+9
gdb/ChangeLog: * README: Document the --with-libgmp-prefix configure option.
2020-11-24gdb/NEWS: Document that GDB now supports DWARF-based fixed point typesJoel Brobecker2-0/+14
gdb/ChangeLog: * NEWS: Add entry documenting support for DWARF-based fixed point types.
2020-11-24gdb/NEWS: Document that building GDB now requires GMPJoel Brobecker2-0/+7
gdb/ChangeLog: * NEWS: Document that building GDB now requires GMP.
2020-11-23Add TYPE_CODE_FIXED_POINT handling in print_type_scalarJoel Brobecker4-10/+33
This commit enhances print_type_scalar to include support for TYPE_CODE_FIXED_POINT. This way, any language falling back to this function for printing the description of some types also gets basic ptype support for fixed point types as well. This fixes a couple of XFAILs in gdb.dwarf2/dw2-fixed-point.exp. gdb/ChangeLog: * typeprint.c (print_type_scalar): Add handling of TYPE_CODE_FIXED_POINT. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-fixed-point.exp: Fix the expected output of the "ptype pck__fp1_range_var" test for the module-2 and pascal languages. Remove the associated setup_xfail.
2020-11-23valarith.c: Replace INIT_VAL_WITH_FIXED_POINT_VAL macro by lambdaJoel Brobecker2-15/+25
gdb/ChangeLog (Simon Marchi <simark@simark.ca>): * valarith.c (fixed_point_binop): Replace the INIT_VAL_WITH_FIXED_POINT_VAL macro by a lambda. Update all users accordingly.
2020-11-23Make function fixed_point_scaling_factor a method of struct typeJoel Brobecker8-15/+26
This logically connects this function to the object it inspects. gdb/ChangeLog: * gdbtypes.h (struct type) <fixed_point_scaling_factor>: New method, replacing fixed_point_scaling_factor. All callers updated throughout this project. (fixed_point_scaling_factor): Delete declaration. * gdbtypes.c (type::fixed_point_scaling_factor): Replaces fixed_point_scaling_factor. Adjust implementation accordingly.
2020-11-23Make fixed_point_type_base_type a method of struct typeJoel Brobecker6-13/+25
As suggested by Simon, to logically connect this function to the object it inspects. Note that, logically, this method should be "const". Unfortunately, the implementation iterates on struct type objects starting with "this", and thus trying to declare the method "const" triggers a compilation error. gdb/ChangeLog: * gdbtypes.h (struct type) <fixed_point_type_base_type> New method, replacing the fixed_point_type_base_type function. All callers updated throughout this project. (fixed_point_type_base_type): Remove declaration. * gdbtypes.c (type::fixed_point_type_base_type): Replaces fixed_point_type_base_type. Adjust implementation accordingly.
2020-11-23gdbtypes.h: Get rid of the TYPE_FIXED_POINT_INFO macroJoel Brobecker4-16/+48
This is one step further towards the removal of all these macros. gdb/ChangeLog: * gdbtypes.h (struct type) <fixed_point_info, set_fixed_point_info>: New methods. (INIT_FIXED_POINT_SPECIFIC): Adjust. (TYPE_FIXED_POINT_INFO): Delete macro. (allocate_fixed_point_type_info): Change return type to void. * gdbtypes.c (copy_type_recursive): Replace the use of TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method. (fixed_point_scaling_factor): Likewise. (allocate_fixed_point_type_info): Change return type to void. Adjust implementation accordingly. * dwarf2/read.c (finish_fixed_point_type): Replace the use of TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
2020-11-23gmp-utils: Convert the read/write methods to using gdb::array_viewJoel Brobecker8-43/+68
This commit changes the interfaces of some of the methods declared in gmp-utils to take a gdb::array_view of gdb_byte instead of a (gdb_byte *, size) couple. This makes these methods' API probably more C++-idiomatic. * gmp-utils.h (gdb_mpz::read): Change buf and len parameters into one single gdb::array_view parameter. (gdb_mpz::write): Likewise. (gdb_mpq::read_fixed_point, gdb_mpq::write_fixed_point): Likewise. * gmp-utils.c (gdb_mpz::read): Change buf and len parameters into one single gdb::array_view parameter. Adjust implementation accordingly. (gdb_mpz::write): Likewise. (gdb_mpq::read_fixed_point, gdb_mpq::write_fixed_point): Likewise. * unittests/gmp-utils-selftests.c: Adapt following changes above. * valarith.c, valops.c, valprint.c, value.c: Likewise.
2020-11-23change and rename gmp_string_asprintf to return an std::stringJoel Brobecker6-17/+27
This was suggested by Simon during a code review of this package upstream. The upside is that this makes the function's API more natural and C++. The downside is an extra malloc, which might be the reason why we went for using a unique_xmalloc_ptr in the first place. Since this function is not expected to be called frequently, the API improvement might be worth the performance impact. gdb/ChangeLog: * gmp-utils.h (gmp_string_printf): Rename from gmp_string_asprintf. Change return type to std::string. Update all callers. * gmp-utils.c (gmp_string_printf): Likewise.
2020-11-24Fix stack smashing error during gdb_mpq_write_fixed_point selftestJoel Brobecker2-1/+6
When building GDB using Ubuntu 20.04's system libgmp and compiler, running the "maintenance selftest" command triggers the following error: | Running selftest gdb_mpq_write_fixed_point. | *** stack smashing detected ***: terminated | [1] 1092790 abort (core dumped) ./gdb gdb This happens while trying to construct an mpq_t object (a rational) from two integers representing the numerator and denominator. In our test, the numerator is -8, and the denominator is 1. The problem was that the rational was constructed using the wrong function. This is what we were doing prior to this patch: mpq_set_ui (v.val, numerator, denominator); The 'u' in "ui" stands for *unsigned*, which is wrong because numerator and denominator's type is "int". As a result of the above, instead of getting a rational value of -8, we get a rational with a very large positive value (gmp_printf says "18446744073709551608"). From there, the test performs an operation which is expected to write this value into a buffer which was not dimensioned to fit such a number, thus leading GMP into a buffer overflow. This was verified by applying the formula that GMP's documentation gives for the required memory buffer size needed during export: | When an application is allocating space itself the required size can | be determined with a calculation like the following. Since | mpz_sizeinbase always returns at least 1, count here will be at | least one, which avoids any portability problems with malloc(0), | though if z is zero no space at all is actually needed (or written). | | numb = 8*size - nail; | count = (mpz_sizeinbase (z, 2) + numb-1) / numb; | p = malloc (count * size); With the very large number, mpz_sizeinbase returns 66 and thus the malloc size becomes 16 bytes instead of the 8 we allocated. This patch fixes the issue by using the correct "set" function. gdb/ChangeLog: * unittests/gmp-utils-selftests.c (write_fp_test): Use mpq_set_si instead of mpq_set_ui to initialize our GMP rational.
2020-11-24Automatic date update in version.inGDB Administrator1-1/+1
2020-11-23gdb/testsuite: show evaluation errors in gdb_assertSimon Marchi2-1/+12
Let's say you put this gdb_assert in a test: gdb_assert "some invalid tcl code" You just get: FAIL: gdb.base/template.exp: some invalid tcl code That's not very easy to debug, since you don't know what's invalid in your code. Change gdb_assert to print the error message when catch's return code is 1 (TCL_ERROR). The "warning" is shown both on stdout and in the log file. Mark the test as unresolved, because the evaluation error means we couldn't reach a valid pass/fail conclusion. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_assert): Show error message on error. Change-Id: Ie6477859554e909ed8d07fb2769c6f2f55e7cce6
2020-11-23[gdb/testsuite] Fix minimal encodings KPASSesTom de Vries4-6/+15
With current master I see a couple of KPASSes: ... KPASS: gdb.ada/enum_idx_packed.exp: scenario=minimal: ptype small \ (PRMS minimal encodings) ... KPASS: gdb.ada/mod_from_name.exp: scenario=minimal: print xp \ (PRMS minimal encodings) KPASS: gdb.ada/pckd_arr_ren.exp: scenario=minimal: print var \ (PRMS minimal encodings) ... The corresponding setup_kfail is called for everything before gnat 11. However, the test-cases also PASS for me with gnat-4.8, gnat-7.5.0 and gnat-8.4.0. Fix the KPASSes by limiting the setup_kfail to gnat 9 and 10. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-11-23 Tom de Vries <tdevries@suse.de> * gdb.ada/enum_idx_packed.exp: Limit setup_kfail to gnat 9 and 10. * gdb.ada/mod_from_name.exp: Same. * gdb.ada/pckd_arr_ren.exp: Same.
2020-11-23[gdb] Don't return non-existing path in debuginfod_source_queryTom de Vries2-2/+9
When setting env var DEBUGINFOD_URLS to " " and running the testsuite, we run into these regressions: ... FAIL: gdb.base/list-missing-source.exp: info source FAIL: gdb.base/source-dir.exp: info source before setting directory search list ... Setting var DEBUGINFOD_URLS to " " allows the debuginfod query function debuginfod_source_query to get past its early exit. The function debuginfod_source_query is documented as: "If the file is successfully retrieved, its path on the local machine is stored in DESTNAME". However, in case we get back -ENOENT from libdebuginfod, we still set DESTNAME: .... if (fd.get () < 0 && fd.get () != -ENOENT) printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), safe_strerror (-fd.get ()), styled_string (file_name_style.style (), srcpath)); else *destname = make_unique_xstrdup (srcpath); return fd; ... Fix this by making debuginfod_source_query fit it's documentation and only setting DESTNAME when successfully retrieving a file. Likewise in debuginfod_debuginfo_query. gdb/ChangeLog: 2020-11-23 Tom de Vries <tdevries@suse.de> * debuginfod-support.c (debuginfod_source_query) (debuginfod_debuginfo_query): Only set DESTNAME if successful.
2020-11-23Fix an illegal memory access when accessing corrupt dynamic secondary ↵Nick Clifton4-8/+23
relocations. PR 26931 * elf-bfd.h (struct elf_backend_data): Add bfd_boolean field to slurp_secondary_relocs field. (_bfd_elf_slurp_secondary_reloc_section): Update prototype. * elf.c (_bfd_elf_slurp_secondary_reloc_section): Add new parameter. Compute number of symbols based upon the new parameter. * elfcode.h (elf_slurp_reloc_table): Pass dynamic as new parameter.
2020-11-23s390x: Set .got sh_entsize only if .got size > 0H.J. Lu6-1/+45
bfd/ PR ld/26918 * elf64-s390.c (elf_s390_finish_dynamic_sections): Set .got sh_entsize only if .got size > 0. ld: PR ld/26918 * testsuite/ld-s390/pr26918-1.d: New file. * testsuite/ld-s390/pr26918-1.s: Likewise. * testsuite/ld-s390/s390.exp: Run all *.d tests.
2020-11-23ld: Make ARC's tls_ie-01 test more flexibleShahab Vahedi2-7/+60
This is to address the regressions addressed by Nic [1]. The regular expression pattern for the tls_ie-01 test was too strict and raising false alarms. The new pattern only looks for matches that should be there AND ignores the boiler plates from the object dump. [1] New failures for ARC targets in linker testsuite https://sourceware.org/pipermail/binutils/2020-November/114177.html ld/ * testsuite/ld-arc/tls_ie-01.d: Use a more general pattern.