aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-08-30Fix gdb.flush documentationTom Tromey1-1/+1
The gdb.flush documentation does not mention the 'stream' argument in the function signature, only in the description. This patch fixes the oversight.
2022-08-30BFD library: Use entry 0 in directory and filename tables of DWARF-5 debug info.Nick Clifton4-29/+76
PR 29529 * dwarf2.c (struct line_info_table): Add new field: use_dir_and_file_0. (concat_filename): Use new field to help select the correct table slot. (read_formatted_entries): Do not skip entry 0. (decode_line_info): Set new field depending upon the version of DWARF being parsed. Initialise filename based upon the setting of the new field.
2022-08-30gdb: update ranged_breakpoint::print_one_detail in commentsEnze Li2-2/+2
The print_one_detail_ranged_breakpoint has been renamed to ranged_breakpoint::print_one_detail in this commit: commit ec45bb676c9c69c30783bcf35ffdac8280f3b8bc Date: Sat Jan 15 16:34:51 2022 -0700 Convert ranged breakpoints to vtable ops So their comments should be updated as well.
2022-08-30Add a testcase for PR 29494.Nick Clifton3-0/+10001
PR 29494 * testsuite/gas/arm/pr29494.s: New test source file. * testsuite/gas/arm/pr29494.d: New test driver.
2022-08-30LoongArch: Fix redefinition of "PACKAGE".liuzhensong1-1/+1
Running configure and make in binutils-gdb. $ ./configure $ make In file included from ./as.h:37, from ./config/loongarch-lex.l:21, from config/loongarch-lex-wrapper.c:20: ./config.h:206: error: “PACKAGE” redefined [-Werror] #define PACKAGE "gas" ... gas/config * loongarch-lex-wrapper.c
2022-08-30RISC-V: Add 'Zmmul' extension in assembler.Tsukasa OI30-27/+175
Three-part patch set from Tsukasa OI to support zmmul in assembler. The 'Zmmul' is a RISC-V extension consisting of only multiply instructions (a subset of 'M' which has multiply and divide instructions). bfd/ * elfxx-riscv.c (riscv_implicit_subsets): Add 'Zmmul' implied by 'M'. (riscv_supported_std_z_ext): Add 'Zmmul' extension. (riscv_multi_subset_supports): Add handling for new instruction class. gas/ * testsuite/gas/riscv/attribute-09.d: Updated implicit 'Zmmul' by 'M'. * testsuite/gas/riscv/option-arch-02.d: Likewise. * testsuite/gas/riscv/m-ext.s: New test. * testsuite/gas/riscv/m-ext-32.d: New test (RV32). * testsuite/gas/riscv/m-ext-64.d: New test (RV64). * testsuite/gas/riscv/zmmul-32.d: New expected output. * testsuite/gas/riscv/zmmul-64.d: Likewise. * testsuite/gas/riscv/m-ext-fail-xlen-32.d: New test (failure by using RV64-only instructions in RV32). * testsuite/gas/riscv/m-ext-fail-xlen-32.l: Likewise. * testsuite/gas/riscv/m-ext-fail-zmmul-32.d: New failure test (RV32 + Zmmul but with no M). * testsuite/gas/riscv/m-ext-fail-zmmul-32.l: Likewise. * testsuite/gas/riscv/m-ext-fail-zmmul-64.d: New failure test (RV64 + Zmmul but with no M). * testsuite/gas/riscv/m-ext-fail-zmmul-64.l: Likewise. * testsuite/gas/riscv/m-ext-fail-noarch-64.d: New failure test (no Zmmul or M). * testsuite/gas/riscv/m-ext-fail-noarch-64.l: Likewise. include/ * opcode/riscv.h (enum riscv_insn_class): Added INSN_CLASS_ZMMUL. ld/ * testsuite/ld-riscv-elf/attr-merge-arch-01.d: We don't care zmmul in these testcases, so just replaced m by a. * testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i2p1_a2p0.s: Renamed. * testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i2p1_a2p1.s: Renamed. opcodes/ * riscv-opc.c (riscv_opcodes): Updated multiply instructions to zmmul.
2022-08-30[gdb/symtab] Fix assert in set_lengthTom de Vries2-1/+83
When running the included test-case, we run into: ... (gdb) break _start^M read.h:309: internal-error: set_length: \ Assertion `m_length == length' failed.^M ... The problem is that while there are two CUs: ... $ readelf -wi debug-names-missing-cu | grep @ Compilation Unit @ offset 0x0: Compilation Unit @ offset 0x2d: ... the CU table in the .debug_names section only contains the first one: ... CU table: [ 0] 0x0 ... The incomplete CU table makes create_cus_from_debug_names_list set the size of the CU at 0x0 to the actual size of both CUs combined. This eventually leads to the assert, when we read the actual size from the CU header. While having an incomplete CU table in a .debug_names section is incorrect, we need a better failure mode than asserting. The easiest way to fix this is to set the length to 0 (meaning: unkown) in create_cus_from_debug_names_list. This makes the failure mode to accept the incomplete CU table, but to ignore the missing CU. It would be nice to instead reject the .debug_names index, and build a complete CU list, but the point where we find this out is well after dwarf2_initialize_objfile, so it looks rather intrusive to restart at that point. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29453
2022-08-30[gdb/tdep] Declare score-*-* target obsoleteTom de Vries2-1/+1
I tried out the script gdb/gdb_mbuild.sh, and ran into: ... score-elf ... ... configure --target=score-elf ... make score-elf ... run score-elf score-elf: gdb dumped core Terminated ... Gdb runs into this internal error in initialize_current_architecture: ... if (! gdbarch_update_p (info)) internal_error (__FILE__, __LINE__, _("initialize_current_architecture: Selection of " "initial architecture failed")); ... The call to gdbarch_update_p fails because commit 575b4c298a6 ("gdb: Remove support for S+core") removed support for the architecture. Fix this by adding score-*-* to the list of obsolete targets in gdb/configure.tgt, such that we're no longer able to build the configuration: ... *** Configuration score-unknown-elf is obsolete. *** Support has been REMOVED. make: *** [Makefile:12806: configure-gdb] Error 1 ... Also remove the related line from the "Target Instruction Set Architectures" list in gdb/MAINTAINERS, such that gdb/gdb_mbuild.sh no longer tries to build it.
2022-08-30Automatic date update in version.inGDB Administrator1-1/+1
2022-08-29Automatic date update in version.inGDB Administrator1-1/+1
2022-08-28PR29494 Trailing jump table on ARMAlan Modra1-6/+6
out_inc_line_addr and relax_inc_line_addr are passed INT_MAX as line_delta to flag end of section. This filters its way down to size_inc_line_addr and emit_inc_line_addr. Pass line_delta on to scale_addr_delta where it can be used to omit an unaligned opcode error. PR 29494 * dwarf2dbg.c (scale_addr_delta): Delete unnecessary forward decl. Add line_delta param. Don't print error at end of section, just round the address down. (size_inc_line_addr, emit_inc_line_addr): Adjust calls.
2022-08-28Automatic date update in version.inGDB Administrator1-1/+1
2022-08-27bfd: Fix minor bug in read_indexed_address function.rupothar1-3/+3
read_indexed_address function is using offset_size instead of addr_size while reading addrx forms.
2022-08-27Automatic date update in version.inGDB Administrator1-1/+1
2022-08-26gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUGSimon Marchi1-2/+2
Similar to 911438f9f4 ("gdbsupport: fix array-view compilation with c++11 && _GLIBCXX_DEBUG"), but for gdb::optional. I get this error when building with Clang 14 and -std=c++11: CXX agent.o In file included from /home/simark/src/binutils-gdb/gdbsupport/agent.cc:20: In file included from /home/simark/src/binutils-gdb/gdbsupport/common-defs.h:210: In file included from /home/simark/src/binutils-gdb/gdbsupport/common-debug.h:23: /home/simark/src/binutils-gdb/gdbsupport/../gdbsupport/gdb_optional.h:213:5: error: use of this statement in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions] gdb_assert (this->has_value ()); ^ /home/simark/src/binutils-gdb/gdbsupport/gdb_assert.h:35:3: note: expanded from macro 'gdb_assert' ((void) ((expr) ? 0 : \ ^ Change-Id: If0cf55607fc9dbd1925ccb97cd9abbf8993ff264
2022-08-26gdb: change bpstat_print's kind parameter to target_waitkindSimon Marchi2-5/+4
Change from int to target_waitkind, which is really what is is. While at it, remove some outdated doc. The return value is described by a relatively self-describing enum, not a numerical value like the doc says. Change-Id: Id899c853a857c7891c45e5b1639024067d5b59cd
2022-08-26gdb, gdbsupport: configure: factor out yes/no/auto value checkingSimon Marchi3-93/+115
Factor out the code that checks that a value is yes/no or yes/no/auto. Add two macros to gdbsupport/common.m4 and use them in gdb/configure.ac I inspected the changes to configure. Other than whitespace changes, we have some benign changes to the error messages (one of them had an error actually). There are changes to the --enable-source-highlight and --enable-libbacktrace handling, but setting enable_source_highlight / enable_libbacktrace was not really useful anyway, they already had the right value. Change-Id: I92587aec36874309e1605e2d60244649f09a757a
2022-08-26PR12265, Compiling ld/ fails on Solaris 8Alan Modra2-5/+3
The fail was due to -Werror and headers included by dlfcn.h and elf-bfd.h disagreeing about AT_DCACHEBSIZE and other AT_*. Not a serious problem obviously, since release versions of binutils don't enable -Werror and the defines are not used. Anyway, reduce the number of files that might hit this problem by only including dlfcn.h where it is needed. PR 12265 * sysdep.h: Don't include dlfcn.h here. * plugin.c: Include it here.
2022-08-26Automatic date update in version.inGDB Administrator1-1/+1
2022-08-25Allow to document user-defined aliases.Philippe Waroquiers5-34/+146
Compared to the previous version, this version fixes the comments reported by Tom Tromey and ensures that the 'help some-user-documented-alias' shows the alias definition to ensure the user understands this is an alias even if specifically documented. When using 'help ALIASNAME', GDB shows the help of the aliased command. This is a good default behaviour. However, GDB alias command allows to define aliases with arguments possibly changing or tuning significantly the behaviour of the aliased command. In such a case, showing the help of the aliased command might not be ideal. This is particularly true when defining an alias as a set of nested 'with' followed by a last command to launch, such as: (gdb) alias pp10 = with print pretty -- with print elements 10 -- print Asking 'help pp10' shows the help of the 'with' command, which is not particularly useful: (gdb) help pp10 with, pp10, w alias pp10 = with print pretty -- with print elements 10 -- print Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING. Usage: with SETTING [VALUE] [-- COMMAND] .... Such an alias can now be documented by the user: (gdb) document pp10 >Pretty printing an expressiong, printing 10 elements. >Usage: pp10 [PRINT-COMMAND-OPTIONS] EXP >See 'help print' for more information. >end (gdb) help pp10 alias pp10 = with print pretty -- with print elements 10 -- print Pretty printing an expressiong, printing 10 elements. Usage: pp10 [PRINT-COMMAND-OPTIONS] EXP See 'help print' for more information. (gdb) When a user-defined alias is documented specifically, help and apropos use the provided alias documentation instead of the documentation of the aliased command. Such a documented alias is also not shown anymore in the help of the aliased command, and the alias is not listed anymore in the help of the aliased command. In particular for cases such as pp10 example above, indicating that pp10 is an alias of the 'with' command is confusing.
2022-08-25sim/aarch64: Fix aarch64_get_CPSR_bits() declarationJan-Benedict Glaw1-1/+1
Noticed while doing mass builds with a very recent GCC: /usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wno-error=maybe-uninitialized -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wpointer-sign -Wold-style-declaration -Werror -I. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64 -I../common -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../common -I../../include -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../include -I../../bfd -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../bfd -I../../opcodes -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../opcodes -I../.. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../gnulib/import -I../../gnulib/import -g -O2 -c -o cpustate.o -MT cpustate.o -MMD -MP -MF .deps/cpustate.Tpo cpustate.c cpustate.c:270:1: error: conflicting types for 'aarch64_get_CPSR_bits' due to enum/integer mismatch; have 'uint32_t(sim_cpu *, FlagMask)' {aka 'unsigned int(struct _sim_cpu *, FlagMask)'} [-Werror=enum-int-mismatch] 270 | aarch64_get_CPSR_bits (sim_cpu *cpu, FlagMask mask) | ^~~~~~~~~~~~~~~~~~~~~ In file included from sim-main.h:30, from cpustate.c:28: cpustate.h:310:20: note: previous declaration of 'aarch64_get_CPSR_bits' with type 'uint32_t(sim_cpu *, uint32_t)' {aka 'unsigned int(struct _sim_cpu *, unsigned int)'} 310 | extern uint32_t aarch64_get_CPSR_bits (sim_cpu *, uint32_t); | ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
2022-08-25x86: Ignore protected visibility in shared libraries on SolarisH.J. Lu2-2/+4
On x86, the PLT entry in executable may be used as function address for functions in shared libraries. If functions are protected, the function address used in executable can be different from the function address used in shared library. This will lead to incorrect run-time behavior if function pointer equality is needed. By default, x86 linker issues an error in this case. On Solaris, linker issued an error for struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt); where gmtime is a protected function in libc.so. Use gmtime's PLT entry in executable as function address is safe since function pointer equality isn't needed. Ignore protected visibility in shared libraries on Solaris to disable linker error. If function pointer equality is needed, linker will silently generate executable with incorrect run-time behavior on Solaris. PR ld/29512 * elf32-i386.c (elf_i386_scan_relocs): Ignore protected visibility in shared libraries on Solaris. * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
2022-08-25GAS: Add a return type tag to DWARF DIEs generated for function symbols.Nick Clifton6-4/+82
PR 29517 * dwarf2dbg.c (GAS_ABBREV_COMP_UNIT): New defined constant. (GAS_ABBREV_SUBPROG): New defined constant. (GAS_ABBREV_NO_TYPE): New defined constant. (out_debug_abbrev): Use the new defined constants when emitting abbreviation numbers. Generate an abbreviation for an unspecified type. (out_debug_info): Use the new defined constants when referring to abbreviations. Generate a use of the no_type abbreviation. Reference the use when generating DIEs for functions. * testsuite/gas/elf/dwarf-3-func.d: Update to allow for newly extended output from the assembler. * testsuite/gas/elf/dwarf-5-func-global.d: Likewise. * testsuite/gas/elf/dwarf-5-func-local.d: Likewise. * testsuite/gas/elf/dwarf-5-func.d: Likewise.
2022-08-25GAS: Allow AArch64 pseudo-ops to accept the command line separator character.Nick Clifton4-12/+30
PR 29519 * config/tc-aarch64.c (s_unreq): Use find_end_of_line(). (s_aarch64_cpu): Likewise. (s_aarch64_arch): Likewise. (s_aarch64_arch_extension): Likewise. * testsuite/gas/aarch64/pr29519.d: New test driver file. * testsuite/gas/aarch64/pr29519.s: New test source file.
2022-08-25gas: NEWS: Add the RISC-V features for 2.39Palmer Dabbelt1-0/+12
2022-08-25gas: NEWS: Add the RISC-V features for 2.38Palmer Dabbelt1-0/+11
2022-08-25gas: NEWS: Add the RISC-V features for 2.37Palmer Dabbelt1-0/+3
2022-08-25gas: NEWS: Add the RISC-V features for 2.36Palmer Dabbelt1-0/+2
2022-08-25gas: NEWS: Add the RISC-V features for 2.35Palmer Dabbelt1-0/+5
2022-08-25gas: NEWS: Add the RISC-V features for 2.31Palmer Dabbelt1-0/+2
2022-08-25PR11290, avr-ld "out of range error" is confusingAlan Modra3-32/+34
Don't overload bfd_reloc_outofrange with what is really a domain error (target at odd address), or an overflow. PR 11290 * reloc.c (bfd_reloc_other): Correct comment. * elf32-avr.c (avr_final_link_relocate): Return bfd_reloc_other for unaligned reloc target values. Return bfd_reloc_overflow when stubs are too far away and when R_AVR_LDS_STS_16, R_AVR_PORT6, or R_AVR_PORT5 overflow. (elf32_avr_relocate_section): Report more descriptive relocation errors. * bfd-in2.h: Regenerate.
2022-08-25ld: pe: Move the return type to a separate line from the function nameMartin Storsjö2-2/+4
This fixes the coding style of an old, preexisting function.
2022-08-25PR10372, SH: ld test with sim/sh/run fails alwaysAlan Modra1-3/+7
PR 10372 * testsuite/ld-sh/start.s: Add _start sym. Use trapa 34. Create an alloc .stack section.
2022-08-25Re: LoongArch: ld: Fix bug not generate plt when link a dsoAlan Modra1-12/+15
Fixes loongarch32-elf +FAIL: medium jirl plt * testsuite/ld-loongarch-elf/cmodel.exp: Don't run test when no shared library support.
2022-08-25Automatic date update in version.inGDB Administrator1-1/+1
2022-08-24ld: pe: Make archive member file extension comparisons case insensitive when ↵Martin Storsjö2-10/+44
cross compiling too On Windows, filename_cmp is case insensitive, but when cross compiling with libraries that may contain members with uppercase file names, we should keep those comparisons case insensitive when running the build tools on other OSes too. Also make the check for .def consistent with the other ones, fixing out of bounds reads if file names are shorter than 4 characters.
2022-08-24gas: arm: handle multiple .directives on a single line (PR29519)Richard Earnshaw3-20/+73
There's been a long-standing bug in the arm backend where target-specific directives did not correctly handle lines with multiple statements. This patch fixes the issue for all the cases I've been able to find. It does result in a slight change in behaviour when errors are encountered: where, previously, .cpu arm6 bar would result in the error "junk at end of line, first unrecognized character is `b'", we now get "unknown cpu `arm6 bar'", which I think is slightly more helpful anyway. Similar errors are generated for other directives.
2022-08-24gdb: new 'maint print frame-id' commandAndrew Burgess5-0/+157
When debugging a certain class of GDB bug, I often end up wanting to know what GDB thinks the frame-id is in a particular frame. It's not too hard to pull this from some debug output, but I thought it might be nice if there was a maintenance command that could tell us. This commit adds 'maint print frame-id' which prints the frame-id of the currently selected frame. You can also pass a frame level number to find the frame-id for a specific frame. There's a new test too.
2022-08-24LoongArch: ld: Fix bug not generate plt when link a dsoliuzhensong4-0/+49
Fix the bug that can not generate func@plt when linking a undefined function with cmodel=medium. Add testcase. bfd/ * elfnn-loongarch.c ld/testsuite/ld-loongarch-elf/ * cmodel-libjirl.dd * cmodel.exp * libjirl.s
2022-08-24Automatic date update in version.inGDB Administrator1-1/+1
2022-08-23SHT_RELR sh_link and sh_infoAlan Modra1-0/+1
I don't think it makes any sense for a SHT_RELR section to specify a symbol table with sh_link. SHT_RELR relocations don't use symbols. There is no real need to specify sh_info either, SHT_RELR is not for relocatable object files. Anyway, fuzzers of course don't restrict themselves to even half-sensible objects. So they found a hole in objcopy using a non-alloc SHT_RELR in an ET_EXEC. In that case BFD set up the SHT_RELR section as if it were a SHT_REL against the sh_info target section. When it came to reading in the target section relocs, the count was horribly wrong which caused a buffer overflow. * elf.c (bfd_section_from_shdr <SHT_RELR>): Always just make a normal section, don't treat it as a reloc section.
2022-08-23Re: bfd_elf_set_group_contents assertionAlan Modra1-5/+19
Further to commit 7744e3278b9f. * elf.c (bfd_elf_set_group_contents): Restrict loc in loop writing contents, and add another assertion.
2022-08-23Add an option to dlltool to allow the creation of deterministic libraries.Nick Clifton4-38/+91
PR 29489 * dlltool.c (deterministic): New variable. (gen_lib_file): If deterministic is true set the BFD_DETERMINISTIC_OUTPUT flag. (usage): Mention --deterministic-libraries and --non-deterministic-libraries. (long_options): Add new options. (main): Parse new options. * doc/binutils.texi: Document the new options. * NEWS: Mention the new feature.
2022-08-23binutils: Updated my email address.Nelson Chu1-1/+1
binutils/ * MAINTAINERS (RISC-V): Updated my email address.
2022-08-23Automatic date update in version.inGDB Administrator1-1/+1
2022-08-22Implement target async for WindowsTom Tromey2-15/+110
This implements target async for Windows. The basic idea is to have the worker thread block in WaitForDebugEvent, then notify the event loop when an event is seen. In a few situations, this blocking behavior is undesirable, so the functions passed to do_synchronously are changed to return a boolean indicating which behavior is needed.
2022-08-22Move some Windows operations to worker threadTom Tromey1-75/+182
On Windows, certain debugging APIs can only be called from the thread that started (or attached) to the inferior. Also, there is no way on Windows to wait for a debug event in addition to other events. Therefore, in order to implement target async for Windows, gdb will have to call some functions in a worker thread. This patch implements the worker thread and moves the necessary operations there. Target async isn't yet implemented, so this patch does not cause any visible changes.
2022-08-22Avoid crash with Ravenscar tasksTom Tromey1-4/+8
When using Ravenscar, gdb can crash if the user sets a breakpoint very early in task startup. This happens because gdb thinks the runtime is initialized, but in practice the particular task isn't sufficiently initialized. This patch avoids the issue by turning an assertion into an early return. I tested this using the AdaCore internal test suite. I don't know how to test Ravenscar using the FSF test suite.
2022-08-22Fix compile time warning from Clang about error messages not being printed ↵Nick Clifton1-2/+2
safely.
2022-08-22Have readelf warn users if it is asked to decode a LLVM bitcode file or a ↵Nick Clifton2-9/+67
golang object file. * readelf.c (check_magic_number): New function. Checks the magic bytes at the start of a file. If they are not the ELF format magic values, then attempts to generate a helpful error message. (process_file_header): Call check_magic_number.