aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-04-04objcopy: also check --file-alignment option argumentJan Beulich1-0/+5
... to be a power of two, just like --section-alignment does.
2025-04-04binutils: run objcopy set-section-alignment also for COFFJan Beulich1-2/+2
There's no reason to limit this to just ELF. TI C30 and Z8k don't encode section alignment in the section entries though (which can't be quite right, or there would need to be another means by which to express alignment needs), so --set-section-alignment simply has no effect there.
2025-04-04objcopy: constrain --section-alignment to PE binaries againJan Beulich4-54/+3
PR binutils/32732 The --set-section-alignment option is what ought to be used on object files; --section-alignment should be affecting PE binaries only, and only the value stored in the header. Sections don't individually have alignment recorded there; see 6f8f6017a0c4 ("PR27567, Linking PE files adds alignment section flags to executables"). Undo the core part of 121a3f4b4f4a ("Update objcopy's --section-alignment option so that it sets the alignment flag on..."), which includes removing the testcase again, while leaving all secondary changes in place. (Note that the testcase did fail anyway for i?86-interix, with objdump saying "option -P/--private not supported by this file".)
2025-04-04ar/objcopy: harmonize .exe suffix strippingJan Beulich2-7/+13
With it only being the tail of the name which wants checking, using lbasename() isn't helpful. Mirror what objcopy.c:main() does to ar.c, merely chaning the plain int of the local variable to size_t.
2025-04-04binutils: properly split ar and ranlibJan Beulich5-17/+19
By not linking the exact same object file twice, in particular ranlib can benefit quite a bit from the compiler eliminating dead code.
2025-04-04binutils: properly split objcopy and stripJan Beulich5-16/+16
By not linking the exact same object file twice, in particular strip can benefit quite a bit from the compiler eliminating dead code.
2025-04-03Make gdb/guile codespell-cleanTom Tromey3-2/+5
This cleans up the last codespell reports in the Guile directory and adds gdb/guile to pre-commit. It also tells codespell to ignore URLs. I think this is warranted because many URLs don't really contain words per se; and furthermore if any URL-checking is needed at all, it would be for liveness and not spelling. Also I was wondering why the codespell config is in contrib and not gdb/setup.cfg. Approved-By: Tom de Vries <tdevries@suse.de>
2025-04-03Make gdb/python codespell-cleanTom Tromey2-2/+2
This cleans up the last codespell report in the Python directory and adds gdb/python to pre-commit. Approved-By: Tom de Vries <tdevries@suse.de>
2025-04-04Automatic date update in version.inGDB Administrator1-1/+1
2025-04-03gdb/dwarf: rename cache -> abbrev_cacheSimon Marchi2-6/+6
"cache" is just a bit too generic to be clear. Change-Id: I8bf01c5fe84e076af1afd2453b1a115777630271
2025-04-03Many minor typo fixesTom Tromey82-125/+125
I ran codespell on gdb/*.[chyl] and fixed a bunch of simple typos. Most of what remains is trickier, i.e., spots where a somewhat natural name of something in the code is flagged as a typo. Reviewed-By: Tom de Vries <tdevries@suse.de>
2025-04-03[gdb/testsuite] Fix xfail in gdb.ada/array_of_variant.expTom de Vries1-1/+1
In commit af2b87e649b ("[gdb/testsuite] Add xfail for PR gcc/101633"), I added an xfail that was controlled by variable old_gcc, triggering the xfail for gcc 7 and before, but not for gcc 8 onwards: ... set old_gcc [expr [test_compiler_info {gcc-[0-7]-*}]] ... In commit 1411185a57e ("Introduce and use gnat_version_compare"), this changed to: ... set old_gcc [gnat_version_compare <= 7] ... which still triggered the xfail for gcc 7, because of a bug in gnat_version_compare. After that bug got fixed, the xfail was no longer triggered because the gnatmake version is 7.5.0, and [version_compare {7 5 0} <= {7}] == 0. We could have the semantics for version_compare where we clip the input arguments to the length of the shortest, and so we'd have [version_compare {7 5 0} <= {7}] == [version_compare {7} <= {7}] == 1. But let's stick with the current version-sort semantics, and fix this by using [gnat_version_compare < 8] instead. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2025-04-03[gdb/testsuite] Add gdb.testsuite/version-compare.expTom de Vries2-1/+78
Add a test-case gdb.testsuite/version-compare.exp that excercises proc version_compare, and a note to proc version_compare that it considers v1 < v1.0 instead of v1 == v1.0. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2025-04-03Fix parsing .debug_aranges section for signed addresses.Martin Simmons1-2/+8
Some architectures, such as MIPS, have signed addresses and this changes read_addrmap_from_aranges to record them as signed when required. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32658 Approved-By: Tom Tromey <tom@tromey.com>
2025-04-03Fix pp.rs test for gccrsTom Tromey1-4/+9
gccrs still can't process all of gdb's Rust tests, but I did manage to manually test it on a few. In addition to filing some bug reports, I came up with this patch. There are two fixes here. First, gccrs emits tuple field names as integers ("0", "1", etc) whereas rustc uses a leading double underscore ("__0", "__1", etc). This patch changes gdb to accept the gccrs output, which IMO makes sense (and for which there's already a rustc feature request). Second, it changes rust_struct_anon::evaluate to use check_typedef. This is a gdb necessity in general, so could be described as an oversight; but in this case it works around the gccrs oddity that most named types are emitted as DW_TAG_typedef. I've filed a gccrs bug report for that.
2025-04-03[pre-commit] Add codespell-clean gdb subdirsTom de Vries1-1/+1
As an alternative to adding the gdb dir to codespell while it's still not codespell-clean [1], add gdb subdirs which are codespell-clean. Found using: ... $ for d in $(find gdb -maxdepth 1 -type d | egrep -v "testsuite|gdb$"); do \ echo -n "$d: "; \ codespell --config gdb/contrib/setup.cfg $d 2>/dev/null \ | wc -l; \ done 2>&1 \ | grep ": 0" gdb/tui: 0 gdb/target: 0 gdb/data-directory: 0 gdb/po: 0 gdb/system-gdbinit: 0 gdb/mi: 0 gdb/syscalls: 0 gdb/arch: 0 gdb/regformats: 0 gdb/compile: 0 ... Verified using: ... $ pre-commit run codespell --all-files codespell................................................................Passed ... Approved-By: Tom Tromey <tom@tromey.com> [1] https://sourceware.org/pipermail/gdb-patches/2025-March/216781.html
2025-04-03ld/testsuite/ld-pe: Escape dots in regular expressionsLIU Hao1-4/+4
Signed-off-by: LIU Hao <lh_mouse@126.com> ld/ChangeLog: * testsuite/ld-pe/secidx.d: Escape dots in regular expressions.
2025-04-03Automatic date update in version.inGDB Administrator1-1/+1
2025-04-02Clean up cooked_index::done_readingTom Tromey4-30/+28
The cooked index worker maintains the state for the various state transition in the scanner. It is held by the cooked_index while scanning is in progress, then deleted once this has completed. I noticed that none of the arguments to cooked_index::done_reading were really needed -- the cooked_index already has access to the worker should it need it. Removing these parameters makes the code a bit simpler and also cleans up some confusing code around the use of the deferred warnings object. Regression tested on x86-64 Fedora 40. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-02Update copyright.pyTom Tromey1-168/+42
copyright.py needed an addition for unordered_dense.h. Then, when running it, I saw it complain about some .pyc files I had in the source tree. I don't know why I had these, but the script should ignore them. For this, Kévin suggested using "git ls-files" to determine which files to update -- that should automatically exclude any random files in the tree. This version of the patch makes this change. There were complaints about some sim/ppc files that were renamed. Ignoring the entire directory seems simpler given the comment. I also made a few more minor changes: * Removed the 'CVS' exclusion, as this hasn't been relevant in years. * Moved the 'copying.c' exclusion to EXCLUDE_LIST * Changed the script to run from the top level (we could have it automatically find this if we really wanted). After this lands, I plan to run it and check in the result. The patch may be too large (and certainly too uninteresting) to post, so if/when this happens I will send a brief note to the list about it. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-02gdb/dwarf2: remove unused includesSimon Marchi4-11/+2
Remove some includes reported as unused by clangd. Change-Id: I841938c3c6254e4f0d154a1e172c4968ff326333
2025-04-02gdb: remove unused includes in dbxread.cSimon Marchi1-19/+1
Remove includes reported as unused by clangd. Change-Id: I12e5cf254d211f42f3cfdab90d1f42a5986e53a3
2025-04-02Fix gdbserver crashes on SVE/SME-enabled systemsLuis Machado2-1/+30
Commit 51e6b8cfd649013ae16a3d00f1451b2531ba6bc9 fixed a regression for SVE/SME registers on gdb's side by using a <= comparison for regcache's raw_compare assertion check. We seem to have failed to do the same for gdbserver's raw_compare counterpart. With the code as it is, I'm seeing a lot of crashes for gdbserver on a machine with SVE enabled. For instance, with the following invocation: make check-gdb RUNTESTFLAGS="--target_board=native-gdbserver" TESTS=gdb.base/break.exp Running /work/builds/binutils-gdb/gdb/testsuite/../../../../repos/binutils-gdb/gdb/testsuite/gdb.base/break.exp ... FAIL: gdb.base/break.exp: test_break: run until function breakpoint FAIL: gdb.base/break.exp: test_break: run until breakpoint set at a line number (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:function(6) breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:function(5) breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:function(4) breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:function(3) breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:function(2) breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:function(1) breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until quoted breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: run until file:linenum breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: breakpoint offset +1 FAIL: gdb.base/break.exp: test_break: step onto breakpoint (the program is no longer running) FAIL: gdb.base/break.exp: test_break: setting breakpoint at } FAIL: gdb.base/break.exp: test_break: continue to breakpoint at } (the program is no longer running) FAIL: gdb.base/break.exp: test_no_break_on_catchpoint: runto: run to main FAIL: gdb.base/break.exp: test_break_nonexistent_line: runto: run to main FAIL: gdb.base/break.exp: test_break_default: runto: run to main FAIL: gdb.base/break.exp: test_break_silent_and_more: runto: run to main FAIL: gdb.base/break.exp: test_break_line_convenience_var: runto: run to main FAIL: gdb.base/break.exp: test_break_user_call: runto: run to main FAIL: gdb.base/break.exp: test_finish_arguments: runto: run to main FAIL: gdb.base/break.exp: test_next_with_recursion: kill program FAIL: gdb.base/break.exp: test_next_with_recursion: run to factorial(6) FAIL: gdb.base/break.exp: test_next_with_recursion: continue to factorial(5) (the program is no longer running) FAIL: gdb.base/break.exp: test_next_with_recursion: backtrace from factorial(5) FAIL: gdb.base/break.exp: test_next_with_recursion: next to recursive call (the program is no longer running) FAIL: gdb.base/break.exp: test_next_with_recursion: next over recursive call (the program is no longer running) FAIL: gdb.base/break.exp: test_next_with_recursion: backtrace from factorial(5.1) FAIL: gdb.base/break.exp: test_next_with_recursion: continue until exit at recursive next test (the program is no longer running) FAIL: gdb.base/break.exp: test_break_optimized_prologue: run until function breakpoint, optimized file FAIL: gdb.base/break.exp: test_break_optimized_prologue: run until breakpoint set at small function, optimized file (the program is no longer running) FAIL: gdb.base/break.exp: test_rbreak_shlib: rbreak junk Adjusting the regcache raw_compare assertion check to use <= fixes the problem on aarch64-linux on a SVE-capable system. This patch also adds a simple selftest to gdbserver that validates this particular case by simulating a raw_compare operation. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32775 Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-02Add optional filename argument to the linker's --stats option, allowing ↵Nick Clifton14-28/+622
extra resource use information to be reported.
2025-04-02Add gdb.base/set-solib-absolute-prefix.expAlexandra Hajkova2-0/+83
Compile a 32-bit x86 executable and then stop within a system call. Change the sysroot to a non-existent directory, GDB should try (and fail) to reload the currently loaded shared libraries. However, GDB should retain the symbols for the vDSO library as that is not loaded from the file system. Check the backtrace to ensure that the __kernel_vsyscall symbol is still in the backtrace, this indicates GDB still has the vDSO symbols available. This test was present in Fedora for a long time and was originally written by Jan Kratochvil for this fix 829a902da291e72ad17e8c44fa8d9ead3db41b1f. Co-Authored-By: Jan Kratochvil <jan.kratochvil@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-04-02Automatic date update in version.inGDB Administrator1-1/+1
2025-04-01gdb: move addrmap::relocate method to addrmap_fixedSimon Marchi2-17/+3
The relocate method of addrmap is unnecessarily virtual. Only addrmap_fixed provides a meaningful implementation. Move the method to addrmap_fixed only and make it non-virtual. Change-Id: If61d5e70abc12c17d1e600adf0dd0707e77a6ba2 Approved-By: Tom Tromey <tom@tromey.com>
2025-04-01[gdb/contrib] Support gdb in codespell section of setup.cfgTom de Vries1-1/+1
Add support for the gdb dir in the codespell section of gdb/contrib/setup.cfg, specifically adding files in the skip line. This allows us to run codespell from the command line on the gdb dir: ... $ codespell --config gdb/contrib/setup.cfg gdb 2>/dev/null | wc -l 1665 ... without running into warnings in generated files. Approved-By: Tom Tromey <tom@tromey.com>
2025-04-01Update cooked_index commentTom Tromey1-0/+9
This updates the cooked_index comment with some notes about object lifetimes, in an attempt to make navigating this code a bit simpler. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Add cooked_index_worker::done_readingTom Tromey4-33/+35
The two readers currently using cooked_index_worker shared some code. This patch factors this out into a new "done_reading" method. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Remove cooked_index_worker::result_typeTom Tromey5-66/+122
cooked_index_worker::result_type is an ad hoc tuple type used for transferring data between phases of the indexer. It's a bit unwieldy and another patch I'm working on would be somewhat nicer without it. This patch removes the type. Now cooked_index_ephemeral objects are transferred instead, which is handy because they already hold the needed state. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Add addrmap_mutable::clearTom Tromey2-35/+55
It was convenient to add a 'clear' method to addrmap_mutable. The cleanest way to do this was to change the class to lazily initialize its 'tree' member. This also makes addrmap_mutable::operator= a bit less weird. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Update comments from moved methodsTom Tromey3-14/+14
This updates the "See xyz.h" comments for all the methods that were moved earlier in this series. Perhaps I should have removed them instead. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Move cooked_index_worker to cooked-index-worker.[ch]Tom Tromey4-273/+270
This moves the cooked_index_worker class to cooked-index-worker.[ch]. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Change includes in cooked-index-worker.hTom Tromey1-4/+3
This changes cooked-index-worker.h to include the new header files. This breaks the circular dependency that would otherwise be introduced in the next patch. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Move cooked_index_shard to new filesTom Tromey5-417/+468
This moves cooked_index_shard to a couple of new files, dwarf2/cooked-index-shard.[ch]. The rationale is the same as the previous patch: cooked-index.h had to be split to enable other cleanups. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Move cooked_index_entry to new filesTom Tromey5-446/+503
This moves cooked_index_entry and some related helper code to a couple of new files, dwarf2/cooked-index-entry.[ch]. The main rationale for this is that in order to finish this series and remove "cooked_index_worker::result_type", I had to split cooked-index.h into multiple parts to avoid circular includes. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Make language_requires_canonicalization 'static'Tom Tromey2-9/+5
language_requires_canonicalization is only called from cooked-index.c, so mark it as static. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Rename cooked_index_storageTom Tromey5-23/+27
This renames cooked_index_storage to cooked_index_worker_result, making its function more clear. It also updates the class comment to as well. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01Rename cooked-index-storage.[ch]Tom Tromey5-15/+15
A discussion with Simon made me realize that cooked_index_storage isn't a very clear name, especially now that it's escaped from read.c. While it does provide some storage (I guess any object does in a sense), it is really a helper for cooked_index_worker -- a temporary object that is destroyed after reading has completed. This patch renames this file. Later patches will rename the class and move cooked_index_worker here, something I think is reasonable given that cooked_index_storage is really something of a helper class for cooked_index_worker. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-01PR32829, SEGV on objdump function debug_type_samepAlan Modra1-6/+3
u.kenum is always non-NULL, see debug_make_enum_type. PR 32829 * debug.c (debug_type_samep): Correct incomplete enum test. (debug_write_type): Remove dead code.
2025-04-01ubsan: nds32 undefined shiftAlan Modra1-2/+2
Avoid implementation defined behaviour right shift of negative values, and undefined behaviour left shift of negative values. While this change might give different results in the top bit of a bfd_vma (rightshift is 1), that doesn't matter as only the bottom 8 bits of the relocation are used. * elf32-nds32.c (nds32_elf_do_9_pcrel_reloc): Calculate relocation using a bfd_vma type.
2025-04-01Formatting fixes for elf-attrs.cAlan Modra1-19/+19
2025-04-01Check gnatmake version in gnat_version_compareTom Tromey1-3/+7
Tom de Vries pointed out that my earlier change to gnat_version_compare made it actually test gcc's version -- not gnat's. This patch changes gnat_version_compare to examine gnatmake's version, while preserving the nicer API. Approved-By: Tom de Vries <tdevries@suse.de>
2025-04-01binutils/testsuite: don't tail the same input and output fileClément Chigot1-3/+3
The output file could be created before the input is gathered by tail, erasing the later before it's being proceeded. This happened on rare cases when performing remote tests on Ubuntu 24.04.
2025-04-01binutils/testsuite: move objdump test output into tmpdirClément Chigot2-25/+25
"objdump.out" is a testsuite trace and thus should be created within the tmpdir.
2025-04-01Automatic date update in version.inGDB Administrator1-1/+1
2025-03-31testsuite: fix is_aarch32_targetThiago Jung Bauermann1-6/+9
Commit c221b2f77080 Testsuite: Add gdb_can_simple_compile changed the source file name extension of the test program from .s to .c resulting in compile fails. This, in turn, causes is_aarch32_target checks to fail. Change the test source from an assembly program to a C program using inline assembly. is_amd64_regs_target had a similar problem, which was fixed by commit 224d30d39365 testsuite: fix is_amd64_regs_target This fix — and commit message — are mostly copied from it. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-03-31gdbserver: Add support for MicroBlaze host microblaze*-*-linux*Michael Eager3-0/+253
Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com> Signed-off-by: Michael Eager <eager@eagercon.com>
2025-03-31[gdb/record] Make enum gdb_syscall value names consistentTom de Vries7-14/+14
In enum gdb_syscall, there are 3 entries that do not have the gdb_sys_ prefix ... $ grep gdb_old_ gdb/linux-record.h gdb_old_select = 82, gdb_old_readdir = 89, gdb_old_mmap = 90, ... like all the other entries: ... gdb_sys_restart_syscall = 0, gdb_sys_exit = 1, gdb_sys_fork = 2, gdb_sys_read = 3, ... The three correspond to these entries in arch/x86/entry/syscalls/syscall_32.tbl: ... <number> <abi> <name> <entry point> [<compat entry point> [noreturn]] 82 i386 select sys_old_select compat_sys_old_select 89 i386 readdir sys_old_readdir compat_sys_old_readdir 90 i386 mmap sys_old_mmap compat_sys_ia32_mmap ... As we can see, the enum uses the entry point name, but without the sys_ prefix. There doesn't seem to be a good reason for this. There's another enum value: ... gdb_sys_old_getrlimit = 76, ... corresponding to: ... 76 i386 getrlimit sys_old_getrlimit compat_sys_old_getrlimit ... where we do use the sys_ prefix. Fix this by consistenly using the gdb_sys_ prefix in enum gdb_syscall. No functional changes. Approved-By: Simon Marchi <simon.marchi@efficios.com>