aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
8 daysAdd Ada test case with long array indicesTom Tromey4-0/+104
This patch adds a test case to test that the previous two patches did their job. With the current gdb, this test fails: (gdb) print some_regular_access.all Value out of range. The bug here is that the array has an index type that is wider than 'int', which is perfectly acceptable in Ada. Note that this series doesn't quite go far enough: in Ada the index could be a 128-bit integer. This change would be more invasive; and in practice this doesn't really seem to come up much -- so I've deferred it.
8 daysUse LONGEST rather than int for array slicesTom Tromey4-12/+10
This patch started by removing the remaining calls to longest_to_int from ada-lang.c, then chasing down the callees to make sure they were also using LONGEST. This ended up with a small change to value_slice as well.
8 daysRemove some uses of longest_to_int from ada-lang.cTom Tromey1-10/+8
A few spots in ada-lang.c use longest_to_int -- but in a context where the value is immediately passed to a function accepting LONGEST. This patch removes the offending calls. It turned out to be easy to change find_struct_field as well, so I've included that in this patch.
8 days[gdb/testsuite, tclint] Drop lreverseTom de Vries1-13/+0
When running tclint with lib/future.exp, I get: ... $ tclint lib/future.exp $exp:756:5: redefinition of built-in command 'lreverse' [redefined-builtin] ... The code was added to handle pre-7.5 tcl versions without lreverse. Since we now require Tcl 8.6.2 (as per PR testsuite/33205), drop this. Tested by rerunning tclint. Approved-By: Simon Marchi <simon.marchi@efficios.com> PR testsuite/33403 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33403
8 days[gdb/testsuite, tclint] Fix syntax error in gdb.base/dtrace-probe.expTom de Vries1-2/+2
When running tclint with gdb.base/dtrace-probe.exp I get: ... $ tclint gdb.base/dtrace-probe.exp $exp:67:45: syntax error: expected newline or semicolon, got ] ... due to these lines: ... 67 runto "-probe-dtrace test:two-locations"] 68 runto "-probe-dtrace test:two-locations"] ... Fix this by dropping the trailing ']'. Tested by rerunning tclint. Approved-By: Simon Marchi <simon.marchi@efficios.com> PR testsuite/33403 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33403
8 days[gdb/testsuite, tclint] Fix unrecognized argument in ↵Tom de Vries1-2/+2
gdb.trace/mi-traceframe-changed.exp When running tclint on gdb.trace/mi-traceframe-changed.exp, I get: ... $ tclint gdb.trace/mi-traceframe-changed.exp $exp:94:1: unrecognized argument for append: -1 [command-args] $exp:95:1: unrecognized argument for append: -1 [command-args] ... for these lines: ... 94 append testfile -1 95 append binfile -1 ... This seems harmless to me, but since tclint complains, fix this by quoting the -1 arguments. Tested by rerunning tclint. Approved-By: Simon Marchi <simon.marchi@efficios.com> PR testsuite/33403 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33403
8 daysx86: Copy non_got_ref_without_indirect_extern_accessH.J. Lu6-0/+67
Copy non_got_ref_without_indirect_extern_access when copying indirect symbol for weak alias so that _bfd_x86_elf_adjust_dynamic_symbol will properly handle GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS. bfd/ PR ld/33409 * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Copy non_got_ref_without_indirect_extern_access. ld/ PR ld/33409 * testsuite/config/default.exp (NO_DIRECT_EXTERN_ACCESS_CFLAGS): New. * testsuite/ld-elf/shared.exp: Run PR ld/33409 tests. * testsuite/ld-elf/pr33409a.c: New file. * testsuite/ld-elf/pr33409b.c: Likewise. * testsuite/ld-elf/pr33409c.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
8 daysx86-64: Update R_X86_64_TPOFF32 error messageH.J. Lu7-7/+7
Change R_X86_64_TPOFF32 error message from relocation R_X86_64_TPOFF32 against symbol `foo' can not be used when making a shared object; replace local-exec with initial-exec TLS model to relocation R_X86_64_TPOFF32 against symbol `foo' can not be used when making a shared object; local-exec is incompatible with -shared bfd/ PR ld/33408 * elf64-x86-64.c (elf_x86_64_need_pic): Suggest "replace local-exec with initial-exec TLS model" for R_X86_64_TPOFF32. ld/ PR ld/33408 * testsuite/ld-x86-64/tls-le-pic-1-x32.d: Updated. * testsuite/ld-x86-64/tls-le-pic-1.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-2-x32.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-2.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-3-x32.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-3.d: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
9 daystestsuite: RISC-V: Add '.option norvc' to ensure consistent results.Jiawei5-0/+5
Add `.option norvc` to several RISC-V tests to avoid compressed instruction generation. This ensures consistent disassembly and alignment behavior regardless of assembler default options. Discussion see: https://patchwork.sourceware.org/project/binutils/patch/20250910120916.1103023-1-jiawei@iscas.ac.cn/ gas/ChangeLog: * testsuite/gas/riscv/dis-partial-insn.s: Limit compressed. * testsuite/gas/riscv/no-relax-align.s: Ditto. * testsuite/gas/riscv/odd-padding.s: Ditto. * testsuite/gas/riscv/t_insns.s: Ditto. * testsuite/gas/riscv/tlsdesc.s: Ditto.
9 daysRISC-V: Remove ^M for odd-padding.s testcaseNelson Chu1-8/+8
9 daysFix unwinding when restoring a register from one of a greater sizeKevin Buettner7-5/+215
When debugging functions where a callee-saved register is moved to a register of a larger size (e.g., a 64-bit general-purpose register to a 128-bit vector register), GDB would crash when the user issued the "return" command. For example: ldgr %f0, %r11 ; Move 64-bit general-purpose register (r11) ; to 128-bit vector register (f0) .cfi_register r11, f0 ; DW_CFA_register: r11 is stored in f0 ... lgdr %r11, %f0 ; Restore r11 from f0 .cfi_restore r11 ; DW_CFA_restore: r11 is restored to its original ; register (This example uses instructions and registers for the S390x architecture, where this bug was originally found.) If GDB is stopped in the "..." section and the user issues the "return" command, GDB crashes due to a buffer size mismatch during unwinding. Specifically, in frame_register_unwind in frame.c, a buffer the size of the original register (the 64-bit r11 in this example) has been allocated and GDB would like to use memcpy to copy the contents of the register where the original register was saved (the 128-bit f0) to the buffer for the original register. But, fortunately, GDB has an assertion which prevents this from happening: gdb_assert (buffer.size () >= value->type ()->length ()); This patch ensures that GDB uses the original register's type (e.g., r11's type) when unwinding, even if it was marked as saved to a differently typed/sized register (e.g., f0) via .cfi_register (DW_CFA_register). The fix adds a 'struct type *' parameter to value_of_register_lazy() to explicitly track the original register's type. The function frame_unwind_got_register is updated to pass the correct type for the original register. The call chain from frame_register_unwind to frame_unwind_got_register is shown by this backtrace: #0 frame_unwind_got_register (frame=..., regnum=13, new_regnum=128) at gdb/frame-unwind.c:300 #1 0x000000000135d894 in dwarf2_frame_prev_register (this_frame=..., this_cache=0x2204528, regnum=13) at gdb/dwarf2/frame.c:1187 #2 0x00000000014d9186 in frame_unwind_legacy::prev_register ( this=0x211f428 <dwarf2_frame_unwind>, this_frame=..., this_prologue_cache=0x2204528, regnum=13) at gdb/frame-unwind.c:401 #3 0x00000000014e1d12 in frame_unwind_register_value (next_frame=..., regnum=13) at gdb/frame.c:1263 #4 0x00000000014e16b8 in frame_register_unwind (next_frame=..., regnum=13, optimizedp=0x3ffffff813c, unavailablep=0x3ffffff8138, lvalp=0x3ffffff8134, addrp=0x3ffffff8128, realnump=0x3ffffff8124, buffer=...) at gdb/frame.c:1189 The register numbers shown above are for s390x. On s390x, S390_R11_REGNUM has value 13. Vector registers (like f0) are numbered differently from floating-point registers of the same name, leading to regnum 128 for f0 despite S390_F0_REGNUM being assigned a different value in s390-tdep.h. New test cases for aarch64 and x86_64 check for this on more popular architectures and also without dependency on a particular compiler to generate an unusual prologue in which a general purpose register is being moved to a vector register. In both cases, the test simulates the bug found on s390x where a 64-bit frame pointer was being moved to a much wider vector register. These test cases will cause an internal error on their respective architecture, but will pass with this fix in place. When tested on s390x linux (native), this change fixes 59 GDB internal errors and around 200 failures overall. This is the list of internal errors that no longer occur on s390x: FAIL: gdb.base/call-sc.exp: tc: return foo; return call-sc-tc (GDB internal error) FAIL: gdb.base/call-sc.exp: td: return foo; return call-sc-td (GDB internal error) FAIL: gdb.base/call-sc.exp: te: return foo; return call-sc-te (GDB internal error) FAIL: gdb.base/call-sc.exp: tf: return foo; return call-sc-tf (GDB internal error) FAIL: gdb.base/call-sc.exp: ti: return foo; return call-sc-ti (GDB internal error) FAIL: gdb.base/call-sc.exp: tl: return foo; return call-sc-tl (GDB internal error) FAIL: gdb.base/call-sc.exp: tld: return foo; return call-sc-tld (GDB internal error) FAIL: gdb.base/call-sc.exp: tll: return foo; return call-sc-tll (GDB internal error) FAIL: gdb.base/call-sc.exp: ts: return foo; return call-sc-ts (GDB internal error) FAIL: gdb.base/gnu_vector.exp: return from vector-valued function (GDB internal error) FAIL: gdb.base/return-3.exp: in foo: return (GDB internal error) FAIL: gdb.base/return-nodebug.exp: double: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return-nodebug.exp: float: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return-nodebug.exp: int: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return-nodebug.exp: long-long: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return-nodebug.exp: long: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return-nodebug.exp: short: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return-nodebug.exp: signed-char: return from function with no debug info with a cast (GDB internal error) FAIL: gdb.base/return.exp: return value 5 (GDB internal error) FAIL: gdb.base/return.exp: return value 5.0 (GDB internal error) FAIL: gdb.base/return2.exp: return from char_func (GDB internal error) FAIL: gdb.base/return2.exp: return from double_func (GDB internal error) FAIL: gdb.base/return2.exp: return from float_func (GDB internal error) FAIL: gdb.base/return2.exp: return from int_func (GDB internal error) FAIL: gdb.base/return2.exp: return from long_func (GDB internal error) FAIL: gdb.base/return2.exp: return from long_long_func (GDB internal error) FAIL: gdb.base/return2.exp: return from short_func (GDB internal error) FAIL: gdb.base/return2.exp: return from void_func (GDB internal error) FAIL: gdb.base/sigstep.exp: return from handleri: leave handler (GDB internal error) FAIL: gdb.base/structs.exp: types=tc-ti: return foo<n>; return 2 structs-tc-ti (GDB internal error) FAIL: gdb.base/structs.exp: types=tc-tl: return foo<n>; return 2 structs-tc-tl (GDB internal error) FAIL: gdb.base/structs.exp: types=tc-ts: return foo<n>; return 2 structs-tc-ts (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 1 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 2 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 3 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 4 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 5 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 6 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 7 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tc: return foo<n>; return 8 structs-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=td-tf: return foo<n>; return 2 structs-td-tf (GDB internal error) FAIL: gdb.base/structs.exp: types=td: return foo<n>; return 1 structs-td (GDB internal error) FAIL: gdb.base/structs.exp: types=tf-tc: return foo<n>; return 2 structs-tf-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tf-td: return foo<n>; return 2 structs-tf-td (GDB internal error) FAIL: gdb.base/structs.exp: types=tf: return foo<n>; return 1 structs-tf (GDB internal error) FAIL: gdb.base/structs.exp: types=tf: return foo<n>; return 2 structs-tf (GDB internal error) FAIL: gdb.base/structs.exp: types=ti-tc: return foo<n>; return 2 structs-ti-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=ti: return foo<n>; return 1 structs-ti (GDB internal error) FAIL: gdb.base/structs.exp: types=ti: return foo<n>; return 2 structs-ti (GDB internal error) FAIL: gdb.base/structs.exp: types=tl-tc: return foo<n>; return 2 structs-tl-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=tl: return foo<n>; return 1 structs-tl (GDB internal error) FAIL: gdb.base/structs.exp: types=tl: return foo<n>; return 2 structs-tl (GDB internal error) FAIL: gdb.base/structs.exp: types=tld: return foo<n>; return 1 structs-tld (GDB internal error) FAIL: gdb.base/structs.exp: types=tll: return foo<n>; return 1 structs-tll (GDB internal error) FAIL: gdb.base/structs.exp: types=ts-tc: return foo<n>; return 2 structs-ts-tc (GDB internal error) FAIL: gdb.base/structs.exp: types=ts: return foo<n>; return 1 structs-ts (GDB internal error) FAIL: gdb.base/structs.exp: types=ts: return foo<n>; return 2 structs-ts (GDB internal error) FAIL: gdb.base/structs.exp: types=ts: return foo<n>; return 3 structs-ts (GDB internal error) FAIL: gdb.base/structs.exp: types=ts: return foo<n>; return 4 structs-ts (GDB internal error) I have tested this commit on Fedora Linux, with architectures s390x, x86_64, x86_64/-m32, aarch64, ppc64le, and riscv64, with no regressions found. This v2 version makes some changes suggested by Andrew Burgess: It adds an assert to frame_unwind_got_register() and always passes the type of REGNUM to value_of_register_lazy(). It also updates value.h's comment describing value_of_register_lazy(). In his approval message, Andrew requested some changes to the tests. Those have been made exactly as requested. Approved-By: Andrew Burgess <aburgess@redhat.com>
9 daysAutomatic date update in version.inGDB Administrator1-1/+1
9 daysRename expand_symtabs_matchingTom Tromey14-178/+140
After this series, expand_symtabs_matching is now misnamed. This patch renames it, renames some associated types, and also fixes up some comments that I previously missed. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRemove enter_symbol_lookupTom Tromey1-41/+0
The "enter_symbol_lookup" class was introduced to work around the lack of reentrancy in symbol lookup. There were two problems here: 1. The DWARF reader kept a mark bit on the dwarf2_per_cu_data object. This bit is gone now, replaced with a local mark vector. 2. Some spots in gdb first examined the expanded symbol tables, and then on failure expanded some symtabs and searched the newly expanded ones (skipping previousy-expanded ones). Fixing this has been the main point of this series. Now that both of these barriers are gone, I think enter_symbol_lookup can be removed. One proof of this idea is that, without the first fix mentioned above, py-symbol.exp regressed because gdbpy_lookup_static_symbols did not first ensure that the current language was set -- i.e., there was a latent bug in the enter_symbol_lookup patch anyway. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysMake dw_expand_symtabs_matching_file_matcher staticTom Tromey2-10/+8
dw_expand_symtabs_matching_file_matcher is no longer needed outside of read.c, so it can be made static. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert lookup_symbol_in_objfileTom Tromey1-14/+2
This converts lookup_symbol_in_objfile to the callback approach by removing the call to lookup_symbol_in_objfile_symtabs. (The latter is not removed as there are still other callers.) Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert lookup_symbol_via_quick_fnsTom Tromey1-17/+22
This converts lookup_symbol_via_quick_fns to the callback approach, merging the search loop and the call to expand_symtabs_matching. Note that this changes lookup_symbol_via_quick_fns to use a best_symbol_tracker. Before this patch there was a discrepancy here between the two search functions. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysAdd best_symbol_trackerTom Tromey3-40/+49
This adds a new best_symbol_tracker struct. This is used to implement the "best symbol" logic that is used sometimes in symtab.c. This approach makes it simpler and more efficient to track the "best" symbol when searching across multiple blocks. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysSimplify block_lookup_symbolTom Tromey1-22/+1
One loop in block_lookup_symbol is identical to the code in block_lookup_symbol_primary. This patch simplifies the former by having it call the latter. This removes an assert. However, note that the assert is not needed -- it does not check any invariant that must be maintained. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysPass lookup_name_info to block_lookup_symbol_primaryTom Tromey3-6/+6
This changes block_lookup_symbol_primary to accept a lookup_name_info. This follows the general trend of hoisting these objects to the outermost layer where they make sense -- somewhat reducing the cost of using them. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysSimplify block_lookup_symbol_primaryTom Tromey1-8/+2
This simplifies block_lookup_symbol_primary by using block_iterator_range. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert linespec.c:iterate_over_all_matching_symtabsTom Tromey1-7/+10
This converts linespec.c:iterate_over_all_matching_symtabs to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRemove objfile::expand_symtabs_for_functionTom Tromey3-37/+17
objfile::expand_symtabs_for_function only has a single caller now, so it can be removed. This also allows us to merge the expansion and searching phases, as done in other patches in this series. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysSimplify basic_lookup_transparent_typeTom Tromey2-58/+4
This patch changes basic_lookup_transparent_type to always work via the "quick" API -- that is, no separate search of the already-expanded symtabs is needed. This is more efficient when many CUs have already been expanded. It also makes the lookup more consistent, as the result is no longer dependent on the order in which CUs were previously expanded. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRemove expand_symtabs_matchingTom Tromey2-34/+0
The last caller of the global expand_symtabs_matching function has been changed, so now we can remove this function. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert ada-lang.c:map_matching_symbolsTom Tromey1-11/+11
This converts ada-lang.c:map_matching_symbols to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert ada_language_defn::collect_symbol_completion_matchesTom Tromey1-40/+27
This converts ada_language_defn::collect_symbol_completion_matches to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert ada_add_global_exceptionsTom Tromey1-22/+25
This converts ada_add_global_exceptions to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert gdbpy_lookup_static_symbolsTom Tromey1-9/+13
This changes gdbpy_lookup_static_symbols to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysConvert default_collect_symbol_completion_matches_break_onTom Tromey1-19/+14
This converts default_collect_symbol_completion_matches_break_on to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRewrite the .gdb_index readerTom Tromey7-1040/+309
This patch rewrites the .gdb_index reader to create the same data structures that are created by the cooked indexer and the .debug_names reader. This is done in support of this series; but also because, from what I can tell, the "templates.exp" change didn't really work properly with this reader. In addition to fixing that problem, this patch removes a lot of code. Implementing this required a couple of hacks, as .gdb_index does not contain all the information that's used by the cooked index implementation. * The index-searching code likes to differentiate between the various DWARF tags when matching, but .gdb_index lumps many things into a single "other" category. To handle this, we introduce a phony tag that's used so that the match method can match on multiple domains. * Similarly, .gdb_index doesn't distinguish between the type and struct domains, so another phony tag is used for this. * The reader must attempt to guess the language of various symbols. This is somewhat finicky. "Plain" (unqualified) symbols are marked as language_unknown and then a couple of hacks are used to handle these -- one in expand_symtabs_matching and another when recognizing "main". For what it's worth, I consider .gdb_index to be near the end of its life. While .debug_names is not perfect -- we found a number of bugs in the standard while implementing it -- it is better than .gdb_index and also better documented. After this patch, we could conceivably remove dwarf_scanner_base. However, I have not done this. Finally, this patch also changes this reader to dump the content of the index, as the other DWARF readers do. This can be handy when debugging gdb. Acked-By: Simon Marchi <simon.marchi@efficios.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33316
9 daysHave expand_symtabs_matching work for already-expanded CUsTom Tromey2-17/+30
Currently, gdb will search the already-expanded symtabs in one loop, and then also expand matching symtabs in another loop. However, this is somewhat inefficient -- when searching the already-expanded symtabs, all such symtabs are examined. However, the various "quick" implementations already know which subset of symtabs might have a match. This changes the contract of expand_symtabs_matching to also call the callback for an already-expanded symtab. With this change, and some subsequent enabling changes, the number of searched symtabs should sometimes be reduced. This also cuts down on the amount of redundant code. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30736 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRemove dwarf2_per_cu_data::markTom Tromey3-46/+83
This removes dwarf2_per_cu_data::mark, replacing it with a locally-allocated boolean vector. It also inverts the sense of the flag -- now, the flag is true when a CU should be skipped, and false when the CU should be further examined. Also, the validity of the flag is no longer dependent on 'file_matcher != NULL'. This patch makes the subsequent patch to searching a bit simpler, so I've separated it out. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysEntries from anon-struct.exp not in cooked indexTom Tromey3-0/+40
g++ will sometimes use a typedef to give a name to an otherwise anonymous type for linkage purposes. gdb tries to handle this odd scenario, which is enforced by anon-struct.exp. It's difficult to detect this problem in the current tree, but the cooked index does not include an entry for these DIEs. This patch changes gdb to add these to the index. This is needed by subsequent changes in this series. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32519 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRestore "ingestion" of .debug_str when writing .debug_namesTom Tromey1-10/+14
When I rewrote the .debug_names writer (commit 91a42a61), I changed the writer to not import .debug_str into the debug_str_lookup object. However, a later patch in this series needed this again. The issue here was that if a name occurs in the DWARF, and is also allocated, then there is a race, where the created index depends on which DIE is read first. This can cause index-file.exp failures. This patch restores the old approach, avoiding this problem. I also applied a couple of small cleanups to the class. And, I removed the old complaint from the "ingestion" function, as this was not necessary. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysPut all CTF symbols in global scopeTom Tromey2-5/+5
The new approach to searching (solely via the quick API) is more sensitive to discrepancies between the partial and full readers. In CTF, there is some disagreement about which scope to use. CTF doesn't seem to really distinguish between the file and global scope, so this patch takes the simple approach of putting all CTF symbols into the global scope. This changes one test as well. It seems to me that the behavior here is arbitrary and the test is making unwarranted assumptions. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysFix index's handling of DW_TAG_imported_declarationTom Tromey3-1/+10
Currently the full symbol reader puts DW_TAG_imported_declaration in TYPE_DOMAIN, in the global scope. This patch changes the cooked indexer to follow. Without this patch, a later patch in the series would cause nsalias.exp to regress. This also updates read-gdb-index.c to do something similar. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysAda import functions not in indexTom Tromey6-23/+43
The cooked index does not currently contain entries for Ada import functions. This means that whether or not these are visible to "break" depends on which CUs were previously expanded -- clearly a bug. This patch fixes the issue. I think the comments in the patch explain the fix reasonably well. Perhaps one to-do item here is to change GNAT to use DW_TAG_imported_declaration for these imports. This may eventually let us remove some of the current hacks. This version includes a fix from Simon to initialize the new member. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32511 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysEmit some type declarations in .gdb_indexTom Tromey1-8/+68
If you run struct-decl.exp with the .gdb_index board, you will see that "the_type" is not emitted in the index. This would cause a failure in this series. The fix is to ensure that certain necessary type declarations are emitted. However, a naive fix here will regress stub-array-size.exp, where a type declaration and a type definition are both seen -- but the declaration is seen first and causes a failure. This is handled by adding some code (including a mild hack) to filter out type declarations when a corresponding type definition is seen. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysChange ada_decode to preserve upper-case in some situationsTom Tromey4-34/+69
This patch is needed to avoid regressions later in the series. The issue here is that ada_decode, when called with wide=false, would act as though the input needed verbatim quoting. That would happen because the 'W' character would be passed through; and then a later loop would reject the result due to that character. Similarly, with operators=false the upper-case-checking loop would be skipped, but then some names that did need verbatim quoting would pass through. Furthermore I noticed that there isn't a need to distinguish between the "wide" and "operators" cases -- all callers pass identical values to both. This patch cleans up the above, consolidating the parameters and changing how upper-case detection is handled, so that both the operator and wide cases pass-through without issue. I've added new unit tests for this. Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysAdd another minor hack to cooked_index_entry::full_nameTom Tromey1-0/+7
This patch adds another minor hack to cooked_index_entry::full_name. In particular, if GNAT emits non-hierarchical names (still the default as the hierarchical series is blocked on one tricky problem), then a request to compute the "linkage-style" name will now just return the 'name' field. Without this tweak, this series would regress ada-cold-name.exp, because the search would look for "name.cold" but the index would return "name[cold]" as the "linkage" name (which would be wrong). This area is a bit difficult to unravel. The best plan here, IMO, is to change Ada to work like the other languages in gdb: store the natural name and do searches with that name. I think this is achievable, but I didn't want to try it here. I've updated the relevant bug (tagged below) to reflect this. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32766 Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysSkip some tests with "readnow" boardTom Tromey3-0/+12
This series pointed out a few tests that check that a particular index is in use. It seems to me that this does not really make sense when the "readnow" board is in use, as this actually skips index creation. The tests do pass today, but by accident. This patch adds the appropriate "require" line to the tests in question. Approved-By: Simon Marchi <simon.marchi@efficios.com> Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysRemove support for .gdb_index < 7Tom Tromey3-39/+10
This patch removes support for .gdb_index versions less than 7. See the patch that rewrites the reader to understand why this is needed. Approved-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org> Acked-By: Simon Marchi <simon.marchi@efficios.com>
9 daysgas: sframe: skip DW_CFA_GNU_args_size when safe to ignoreIndu Bhagat6-1/+119
Currently, gas warns and skips generating SFrame FDE when it sees: .cfi_escape 0x2e,XX From the documentation of DW_CFA_GNU_args_size: "The DW_CFA_GNU_args_size instruction takes an unsigned LEB128 operand representing an argument size. This instruction specifies the total of the size of the arguments which have been pushed onto the stack." With origins seemingly for VAX architecture, the usage of DW_CFA_GNU_args_size seems to have evolved. The purpose of DW_CFA_GNU_args_size is to adjust SP when performing stack unwinding for exception handling. For the purpose of stack tracing using SFrame, DW_CFA_GNU_args_size is safe to skip, especially when the CFA restoration is known to be FP based. A previous summary of the reasoning and intent was indicated here [1]. [1] https://sourceware.org/pipermail/binutils/2025-August/143829.html This fixes PR gas/33414 - sframe: handle DW_CFA_GNU_args_size in gas better gas/ PR gas/33414 * gen-sframe.c (sframe_xlate_do_escape_gnu_args_size): New definition. (sframe_xlate_do_cfi_escape): Handle DW_CFA_GNU_args_size. gas/testsuite/ PR gas/33414 * gas/cfi-sframe/cfi-sframe.exp: New test. * gas/cfi-sframe/cfi-sframe-common-12.d: New test. * gas/cfi-sframe/cfi-sframe-common-12.s: New test. * gas/cfi-sframe/cfi-sframe-x86_64-3.d: New test. * gas/cfi-sframe/cfi-sframe-x86_64-3.s: New test.
9 daysFix var_arr_typedef.exp to preserve local variableTom Tromey3-3/+5
This patch fixes var_arr_typedef.exp to preserve a local variable a bit better, protecting it from a gnat-llvm optimization.
9 daysx86-64: Fix misleading R_X86_64_TPOFF32 error messageH.J. Lu11-2/+74
R_X86_64_TPOFF32 relocation of local-exec TLS model can only be used in executable, not in a shared library, even if the source code is compiled with -fPIC. Change the linker error message from relocation R_X86_64_TPOFF32 against symbol `foo' can not be used when making a shared object; recompile with -fPIC to relocation R_X86_64_TPOFF32 against symbol `foo' can not be used when making a shared object; replace local-exec with initial-exec TLS model bfd/ PR ld/33408 * elf64-x86-64.c (elf_x86_64_need_pic): Suggest "replace local-exec with initial-exec TLS model" for R_X86_64_TPOFF32. (elf_x86_64_scan_relocs): Drop ABI_64_P check for R_X86_64_TPOFF32. ld/ PR ld/33408 * testsuite/ld-x86-64/tls-le-pic-1-x32.d: New file. * testsuite/ld-x86-64/tls-le-pic-1.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-1.s: Likewise. * testsuite/ld-x86-64/tls-le-pic-2-x32.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-2.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-2.s: Likewise. * testsuite/ld-x86-64/tls-le-pic-3-x32.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-3.d: Likewise. * testsuite/ld-x86-64/tls-le-pic-3.s: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
9 daysld: fix segfault when linker script is not foundMatthieu Longo3-0/+7
ld previously crashed with a segmentation fault if the specified linker script could not be found. The issue seems to have been introduced recently by d048eee2910 [1]. This patch adds a check to ensure that a filename was found after searching the possible prefixes. If no filename was found, the function returns NULL, and ldfile_open_command_file_1() emits a proper fatal error message. This change prevents the crash and provides a clear diagnostic. A new generic test was also added to cover this error case. [1]: https://inbox.sourceware.org/binutils/20250812143757.3565482-1-hjl .tools@gmail.com/
10 daysRevert "binutils: Require GNU tail for 'objdump -Wi' test"H.J. Lu7-76/+4
This reverts commit 897d8d7bba581e4c1614af5712b730b006f03407.
10 daysx86: Correct _bfd_x86_elf_copy_indirect_symbol commentsH.J. Lu1-1/+1
Since commit eeb2f20a764bee3a6a1edb9872467d044aaad848 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Sep 1 13:03:40 2017 -0700 x86: Add _bfd_x86_elf_adjust_dynamic_symbol replaced elf_i386_adjust_dynamic_symbol with _bfd_x86_elf_copy_indirect_symbol, correct the comments. * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Replace elf_i386_adjust_dynamic_symbol with _bfd_x86_elf_copy_indirect_symbol in comments. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
10 daysMicroBlaze: Update gdb/NEWS for GNU/Linux gdbserver targetGopi Kumar Bulusu1-0/+4
* gdb/NEWS : Add MicroBlaze gdbserver target 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> Approved-by: Michael J. Eager <eager@eagercon.com>