aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-04-25LoongArch: Add bad static relocation check and output more information to userLulu Cai8-2/+76
Absolute address symbols cannot be used with -shared. We output more information to the user than just BFD_ASSETR.
2024-04-25LoongArch: The symbol got type can only be obtained after initializationLulu Cai1-1/+8
When scanning relocations and determining whether TLS type transition is possible, it will try to obtain the symbol got type. If the symbol got type record has not yet been allocated space and initialized, it will cause ld to crash. So when uninitialized, the symbol is set to GOT_UNKNOWN.
2024-04-25Automatic date update in version.inGDB Administrator1-1/+1
2024-04-24gdb/testsuite: Add libc_has_debug_info require helperThiago Jung Bauermann2-12/+57
Factor the test for libc debug info out of gdb.base/relativedebug.exp to a new procedure. Also, change the "info sharedlibrary" test to explicitly detect when libc has debug info. Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-04-24gdb/doc: Fix incorrect information in RSP docCiaran Woodward1-1/+1
The 'PacketSize' attribute of the qSupported packet was documented to be the maximum size of the packet including the frame and checksum bytes, however this is not how it was treated in the code. In reality, PacketSize is the maximum size of the data in the RSP packets, not including the framing or checksum bytes. For instance, GDB's remote.c treats it as the maximum number of data bytes. See remote_read_bytes_1, where the size of the request is capped at PacketSize/2 (for hex-encoding). Also see gdbserver's server.cc, where the internal buffer is sized as PBUFSIZ and PBUFSIZ-1 is used as PacketSize. In gdbserver's case, the buffer is not used for any of the framing or checksum characters. (I am not certain where the -1 comes from. I think it comes from back when there were no binary packets, so packets were treated as strings with null terminators). It also seems like gdbservers in the wild treat it in this way: Embocosm doc: https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html#id3078000 A quick glance over openocd's gdb_server.c gdb_put_packet_inner() function shows that the internal buffer also excludes the framing and checksum. Likewise, qEmu's gdbstub.c allocates PacketSize bytes for the internal packet contents, and PacketSize+4 for the full frame. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Pedro Alves <pedro@palves.net>
2024-04-24Handle two-linetable function in find_epilogue_using_linetableBernd Edlinger6-160/+284
Consider the following test-case: ... $ cat hello.c int main() { printf("hello "); #include "world.inc" $ cat world.inc printf("world\n"); return 0; } $ gcc -g hello.c ... The line table for the compilation unit, consisting just of function main, is translated into these two gdb line tables, one for hello.c and one for world.inc: ... compunit_symtab: hello.c symtab: hello.c INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT PROLOGUE-END EPILOGUE-BEGIN 0 3 0x400557 0x400557 Y 1 4 0x40055b 0x40055b Y 2 END 0x40056a 0x40056a Y compunit_symtab: hello.c symtab: world.inc INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT PROLOGUE-END EPILOGUE-BEGIN 0 1 0x40056a 0x40056a Y 1 2 0x400574 0x400574 Y 2 3 0x400579 0x400579 Y 3 END 0x40057b 0x40057b Y ... The epilogue of main starts at 0x400579: ... 400579: 5d pop %rbp 40057a: c3 ret ... Now, say we have an epilogue_begin marker in the line table at 0x400579. We won't find it using find_epilogue_using_linetable, because it does: ... const struct symtab_and_line sal = find_pc_line (start_pc, 0); ... which gets us the line table for hello.c. Fix this by using "find_pc_line (end_pc - 1, 0)" instead. Tested on x86_64-linux. Co-Authored-By: Tom de Vries <tdevries@suse.de> PR symtab/31622 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31622
2024-04-24Fix an out of bounds array access in find_epilogue_using_linetableBernd Edlinger1-10/+84
An out of bounds array access in find_epilogue_using_linetable causes random test failures like these: FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: $fba_value == $fn_fba FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: check frame-id matches FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: bt 2 FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: up FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: $sp_value == $::main_sp FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: $fba_value == $::main_fba FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: [string equal $fid $::main_fid] Here the read happens below the first element of the line table, and the test failure depends on the value that is read from there. It also happens that std::lower_bound returns a pointer exactly at the upper bound of the line table, also here the read value is undefined, that happens in this test: FAIL: gdb.dwarf2/dw2-epilogue-begin.exp: confirm watchpoint doesn't trigger Fixes: 528b729be1a2 ("gdb/dwarf2: Add support for DW_LNS_set_epilogue_begin in line-table") Co-Authored-By: Tom de Vries <tdevries@suse.de> PR symtab/31268 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31268
2024-04-24[gdb/testsuite] Fix gdb.threads/threadcrash.exp for remote hostTom de Vries1-5/+3
With test-case gdb.threads/threadcrash.exp using host board local-remote-host and target board remote-gdbserver-on-localhost I run into: ... (gdb) PASS: gdb.threads/threadcrash.exp: test_gcore: continue to crash gcore $outputs/gdb.threads/threadcrash/threadcrash.gcore^M Failed to open '$outputs/gdb.threads/threadcrash/threadcrash.gcore' for output.^M (gdb) FAIL: gdb.threads/threadcrash.exp: test_gcore: saving gcore UNSUPPORTED: gdb.threads/threadcrash.exp: test_gcore: couldn't generate gcore file ... The problem is that the gcore command tries to save a file on a remote host, but the filename is a location on build. Fix this by using host_standard_output_file. Tested on x86_64-linux.
2024-04-24[gdb/testsuite] Fix gdb.threads/threadcrash.exp with glibc debuginfoTom de Vries1-1/+1
After installing glibc debuginfo, I ran into: ... FAIL: gdb.threads/threadcrash.exp: test_live_inferior: \ $thread_count == [llength $test_list] ... This happens because the clause: ... -re "^\r\n${hs}main$hs$eol" { ... which is intended to match only: ... #1 <hex> in main () at threadcrash.c:423^M ... also matches "remaining" in: ... #1 <hex> in __GI___nanosleep (requested_time=<hex>, remaining=<hex>) at \ nanosleep.c:27^M ... Fix this by checking for "in main" instead. Tested on x86_64-linux.
2024-04-24Update readelf's display of RELR sections to include the number of locations ↵Nick Clifton14-33/+128
relocated
2024-04-24gdb: include extract-store-integer.h in charset.c when PHONY_ICONVSimon Marchi1-0/+2
When building on a system where "phony iconv" is used (NetBSD in this case, not sure why), I get: CXX charset.o /home/smarchi/src/binutils-gdb/gdb/charset.c: In function 'size_t phony_iconv(int, const char**, size_t*, char**, size_t*)': /home/smarchi/src/binutils-gdb/gdb/charset.c:140:8: error: 'extract_unsigned_integer' was not declared in this scope = extract_unsigned_integer ((const gdb_byte *)*inbuf, 4, endian); ^~~~~~~~~~~~~~~~~~~~~~~~ /home/smarchi/src/binutils-gdb/gdb/charset.c:140:8: note: suggested alternative: 'btrace_insn_number' = extract_unsigned_integer ((const gdb_byte *)*inbuf, 4, endian); ^~~~~~~~~~~~~~~~~~~~~~~~ btrace_insn_number Add the necessary include. Change-Id: I10b967584645961c86167a8395d88929a42bef03
2024-04-24PPC maintainersAlan Modra1-2/+1
I'm retiring from IBM, and Geoff hasn't been active for a very long time. * MAINTAINERS (ppc): Remove myself and Geoff Keating. Add Geoff to past maintainers.
2024-04-24buffer overflow in libctf testsAlan Modra2-2/+2
* testsuite/libctf-regression/gzrewrite.c (main): Don't overflow "a" buffer in "after adding types" check. * testsuite/libctf-regression/zrewrite.c (main): Likewise.
2024-04-24Automatic date update in version.inGDB Administrator1-1/+1
2024-04-23gdb: adjust copyright years of extract-store-integer.{c,h}Simon Marchi2-2/+2
The contents of these files was copied from defs.h and findvar. Copy over the copyright years (1986-2024). Change-Id: Idfb0f255fbcfda7e107e9a82804cece3d81ed5fc
2024-04-23arm: Fix MVE vmla encodingClaudio Bantaloukas4-1356/+2042
2024-04-23bfd: Remove duplicate word in elf-vxworks.cOlivier Hainque1-1/+1
PR ld/31652 * elf-vxworks.c (elf_vxworks_emit_relocs): Drop duplicate word.
2024-04-23objcopy.c: Fix bfd_copy_private_symbol_data on 32-bit hostsH.J. Lu1-2/+2
Use long with bfd_copy_private_symbol_data to fix .../binutils/objcopy.c: In function ‘copy_object’: .../binutils/objcopy.c:3383:17: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘long int’ [-Werror=sign-compare] 3383 | for (i = 0; i < symcount; i++) | ^ on 32-bit hosts. PR binutils/14493 * objcopy.c (copy_object): Use long with bfd_copy_private_symbol_data.
2024-04-23gdb: move symbol_file_command declaration to symfile.hSimon Marchi3-17/+17
Move it out of defs.h, the corresponding definition is in symfile.c. Change-Id: I984666c3bcd213f8574e9ec91462e1d61f77f16b Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: remove enum precision_typeSimon Marchi1-7/+0
It is unused. Change-Id: Ic49a3ef03c21b209594cd567ae80b5441606bef6 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: move annotation_level declaration/definition to annotate.{h,c}Simon Marchi5-14/+13
The declaration of annotation_level is currently in defs.h, while the definition is in stack.c. I don't really understand why that variable would live in stack.c, it seems completely unrelated. Move it to annotate.c, and move the declaration to annotate.h. Change-Id: I6cf8e9bd20e83959bdf5ad58dd008b6e1187d7d8 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: move a bunch of quit-related things to event-top.{c,h}Simon Marchi51-88/+144
Move some declarations related to the "quit" machinery from defs.h to event-top.h. Most of the definitions associated to these declarations are in event-top.c. The exceptions are `quit()` and `maybe_quit()`, that are defined in utils.c. For consistency, move these two definitions to event-top.c. Include "event-top.h" in many files that use these things. Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: change type of quit_flag to boolSimon Marchi2-5/+5
Change-Id: I7dc5189ee172e82ef5b2c4a739c011f43a84258b Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: change return type of check_quit_flag to boolSimon Marchi5-12/+12
Change the return type of the check_quit_flag function to bool. Update a few related spots. Change-Id: I9d3a15d3f8651efb02c7d211f06222a592bd4184 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: move declarations of check_quit_flag and set_quit_flag to extension.hSimon Marchi3-32/+34
Move them out of defs.h, to extension.h, since the implementations are in extension.c. Change-Id: Ie7321468bd7fecc684d70b09f72c3ee8ac75d8f4 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: remove unused include in infrun.cSimon Marchi1-1/+1
Remove the gdbcmd.h, which is reported as unused by clangd. Add cli/cli-cmds.h instead, to get access to `cmdlist` and friends. Change-Id: Ic0c60d2f6d3618f1bd9fd80b95ffd7c33c692a04
2024-04-23objdump: Round ASCII art lines in jump visualizationWaqar Hameed1-4/+4
2024-04-23gdb/dwarf2/read.c: remove pessimizing std::moveSimon Marchi1-1/+1
When building with this clang: $ c++ --version FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152) I see: $ gmake CXX dwarf2/read.o /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4890:6: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] std::move (thread_storage.release_parent_map ())); ^ /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4890:6: note: remove std::move call here std::move (thread_storage.release_parent_map ())); ^~~~~~~~~~~ ~ The compiler seems right, there is not need to std::move the result of `release_parent_map ()`, it's already going to be an rvalue. Remove the std::move. The issue isn't FreeBSD-specific, I see it on Linux as well when building hwith clang, I just noticed it on a FreeBSD build first. Change-Id: I7aa20a4db56c799f20d838ad08099a01653bba19 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: bump black version to 24.4.0Simon Marchi1-1/+1
Run `pre-commit autoupdate`, this is the outcome. There is no change in formatting of Python files. Change-Id: I977781fa6cc924c398cc3b9d9954dc0fbb95d082
2024-04-23PR31667, objcopy/strip corrupts solaris binariesAlan Modra1-7/+6
Using want_p_paddr_set_to_zero in commit 45d92439aebd was wrong. Even solaris targets don't have want_p_paddr_set_to_zero, but we should handle them at least somewhat reasonably. PR 31667 * elf.c (IS_SECTION_IN_INPUT_SEGMENT): Remove bed arg, add paddr_valid. Don't use bed->want_p_paddr_set_to_zero. (INCLUDE_SECTION_IN_SEGMENT): Likewise. (rewrite_elf_program_header): Adjust to suit.
2024-04-23ignore some symbols in elf.c:swap_out_symsAlan Modra2-56/+49
The reason behind this patch was noticing that generic ELF targets fail to remove "bar" in the recently committed ld-elf/undefweak-1 test. (Despite that, those targets pass the test due to it being too strict when matching symbols. "bar" gets turned into a local weak defined absolute symbol.) swap_out_syms currently drops local section syms that are defined in discarded sections. Extend that to also drop other symbols in discarded sections too, even global symbols. The linker goes to quite a lot of effort to ensure globals in discarded section take a definition from the kept linkonce or comdat group section. So the global sym change should only affect cases where something is quite wrong about the set of linkonce or comdat group sections. However that change to elf_map_symbols meant we dropped _DYNAMIC_LINK / _DYNAMIC_LINKING for mips, a global absolute symbol given STT_SECTION type for some reason. That problem is fixed by reverting the pr14493 change which is no longer needed due to a) BSF_SECTION_SYM_USED on x86, and b) fixing objcopy to use copy_private_symbol_data. bfd/ PR 14493 * elf.c (ignore_sym): Rename from ignore_section_sym. Return true for any symbol without a section or in a discarded section. Revert pr14493 change. (elf_map_symbols): Tidy. Use ignore_sym on all symbols. (swap_out_syms): Tidy. ld/ * testsuite/ld-elf/undefweak-1.rd: Match any "bar".
2024-04-23xfail undefweak-1 test for alphaAlan Modra1-1/+1
".set" has a different meaning on alpha. Changing it to ".equ" runs into ".equ" having a different meaning on hppa, and changing it to "=" runs into trouble on bfin. * testsuite/ld-elf/elf.exp (undefweak-1): xfail on alpha, don't xfail for genelf.
2024-04-23use copy_private_symbol_data in objcopyAlan Modra1-0/+7
osympp appearing twice here is not a bug. PR 14493 * objcopy.c (copy_object): Run the symbols through bfd_copy_private_symbol_data.
2024-04-23copy_private_symbol_dataAlan Modra1-2/+2
bfd_copy_private_symbol_data is a bfd function that appeared in commit 89665c8562da a long time ago, but seemingly wasn't used anywhere until Jan added it to gas/symbols.c in commit 6a2b6326c21e. The function is used to modify ELF symbol st_shndx for symbols defined in odd sections like .symtab, so that they get the corresponding section st_shndx in an output file. This patch fixes some bitrot in the function. After commit c03551323c04 which introduced output_elf_obj_tdata, elf_strtab_sec and elf_shstrtab_sec will segfault if used on an input bfd. PR 14493 * elf.c (_bfd_elf_copy_private_symbol_data): Don't use elf_strtab_sec and elf_shstrtab_sec.
2024-04-22gdb: don't include gdbsupport/array-view.h in defs.hSimon Marchi1-1/+0
Nothing in defs.h actually uses this. Everything that I (and the buildbot) can compile still compiles, so I guess that all users of array_view already include it one way or another. Worst case, if this causes some build failure, the fix will be one #include away. Change-Id: I981be98b0653cc18c929d85e9afd8732332efd15 Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22gdb: don't include hashtab.h in defs.hSimon Marchi4-2/+3
Nothing in defs.h actually uses this. Add some includes for some spots using things from hashtab.h. Note that if the GDB build doesn't use libxxhash, hashtab.h is included by gdbsupport/common-utils.h, so all files still see hashtab.h. It puzzled me for some time why I didn't see build failures in my build (which didn't use libxxhash) but the buildbot gave build failures (it uses libxxhash). Change-Id: I8efd68decdaf579f048941c7537cd689885caa2a Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22gdb: move RequireLongest to gdbsupport/traits.hSimon Marchi4-4/+7
Move it out of defs.h. Change-Id: Ie1743d41a57f81667650048563e66073c72230cf Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22gdb: move store/extract integer functions to extract-store-integer.{c,h}Simon Marchi141-327/+559
Move the declarations out of defs.h, and the implementations out of findvar.c. I opted for a new file, because this functionality of converting integers to bytes and vice-versa seems a bit to generic to live in findvar.c. Change-Id: I524858fca33901ee2150c582bac16042148d2251 Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22gdb: remove extract_long_unsigned_integerSimon Marchi2-56/+0
It is unused. Change-Id: I5d4091368c4dfc29752b12061e38f1df8353ba74 Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22gdb: move `enum compile_i_scope_types` to compile/compile.hSimon Marchi4-28/+30
Move it out of defs.h, adjust the includes here and there. Change-Id: I11901fdce55d54f5e51723e123cef154cfb1bbc5 Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22gdb: move two declarations out of defs.hSimon Marchi5-9/+10
Move declarations of initialize_progspace and initialize_inferiors to progspace.h and inferior.h, respectively. Change-Id: I62292ffda429861b9f27d8c836a56d161dfa548d Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-23Automatic date update in version.inGDB Administrator1-1/+1
2024-04-22gdb/testsuite: Use default gdb_expect timeout in runtoThiago Jung Bauermann1-1/+1
runto uses a hard-coded timeout of 30s in its invocation of gdb_expect. This is normally fine, but for very a slow system (e.g., an emulator) it may not be enough time for GDB to reach the intended breakpoint. gdb_expect can obtain a timeout value from user-configurable variables when it's not given one explicitly, so use that mechanism instead since the user will have already adjusted the timeout variable to account for the slow system. Approved-By: Tom Tromey <tom@tromey.com>
2024-04-22gdb: fix unknown variable typo in c-exp.yAndrew Burgess1-1/+1
Fix 'val' -> 'value' typo in c-exp.y which was breaking the build. Introduced in commit: commit e6375bc8ebbbc177c79f08e9616eb0b131229f65 Date: Wed Apr 17 16:17:33 2024 -0600 Remove some alloca uses
2024-04-22aarch64: Fix coding style issue in `aarch64-dis.c'Victor Do Nascimento1-1/+1
Fix integer value being returned from boolean function, as introduced in `aarch64: Remove asserts from operand qualifier decoders [PR31595]'.
2024-04-21Use std::vector in event-loop.ccTom Tromey1-39/+18
In my occasional and continuing campaign against realloc, this patch changes event-loop.cc to use std::vector to keep track of pollfd objects. Regression tested on x86-64 Fedora 38. Approved-By: Simon Marchi <simon.marchi@efficios.com> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-22x86/APX: Add invalid check for APX EVEX.X4.Cui, Lili4-1/+12
gas/ChangeLog: * config/tc-i386.c (build_apx_evex_prefix): Added invalid check for APX X4. * testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: Added invalid testcase. * testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: Ditto. opcodes/ChangeLog: * i386-dis.c (get_valid_dis386): Added invalid check for APX X4.
2024-04-22Automatic date update in version.inGDB Administrator1-1/+1
2024-04-21Remove a couple of VLAsTom Tromey2-2/+6
I found a couple of spots where VLAs are in use but where they can easily be removed. In one spot, adding 'const' is enough -- and is already done in similar code elsewhere in the file. In another spot, one of two arrays will be used, so making the buffer large enough for both works. Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-04-21Remove some alloca usesTom Tromey8-64/+16
A few spots (mostly in the parsers) use alloca to ensure that a string is terminated before passing it to a printf-like function (mostly 'error'). However, this isn't needed as the "%.*s" format can be used instead. This patch makes this change. In one spot the alloca is dead code and is simply removed. Regression tested on x86-64 Fedora 38. Approved-By: John Baldwin <jhb@FreeBSD.org>