aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-09-12gdb: Fix -Wuninitialized issueEnze Li1-0/+1
I see the following warning when building GDB on FreeBSD/amd64 with Clang 14, ====================================================================== CXX mdebugread.o mdebugread.c:1069:3: error: variable 'f' is uninitialized when used here [-Werror,-Wuninitialized] f->set_loc_enumval (tsym.value); ^ mdebugread.c:836:17: note: initialize the variable 'f' to silence this warning struct field *f; ^ = nullptr ====================================================================== after digging a little, I realized that we can not simply do what Clang 14 says. The root cause of this issue is that we lost the initialization of the variable 'f' in this commit, commit 2774f2dad5f05e68771c07df6ab0fb23baa2118e Date: Thu Aug 31 09:37:44 2023 +0200 [gdb/symtab] Factor out type::{alloc_fields,copy_fields} we have made these modifications, --------------------------------------------------------------------- --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1034,9 +1034,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, t->set_code (type_code); t->set_length (sh->value); - t->set_num_fields (nfields); - f = ((struct field *) TYPE_ALLOC (t, nfields * sizeof (struct field))); - t->set_fields (f); + t->alloc_fields (nfields, false); --------------------------------------------------------------------- The problem is that the variable 'f' is used in the second half of parse_symbol, that's why Clang complained. To fix this issue we need to ensure that the varibale 'f' is initialized. Calling the fields method is an obvious way to fix this issue. Tested on FreeBSD/amd64 by rebuilding. Approved-By: Tom de Vries <tdevries@suse.de>
2023-09-12gdb/testsuite/rocm: fix rocm-multi-inferior-gpu.cppLancelot Six1-1/+1
The gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp testcase contains a call to execl which does not have NULL as a last argument. This is an invalid use of execl. This patch fixes this oversight. Change-Id: I03b60abe30468d71ba5089b240c6d00f9b8883b2 Approved-By: Tom Tromey <tom@tromey.com>
2023-09-12Automatic date update in version.inGDB Administrator1-1/+1
2023-09-11Specialize std::hash for ptid_tTom Tromey3-5/+4
This changes hash_ptid to instead be a specialization of std::hash. This makes it a little easier to use with standard containers. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-09-11Update Python signal-handling documentationTom Tromey1-2/+4
I noticed a typo in the "Basic Python" node, and when fixing it realized that the paragraph could use a link to the block_signals function. This patch is the result. Approved-By: Eli Zaretskii <eliz@gnu.org>
2023-09-11gdb/testsuite: use foreach_with_prefix in gdb.guile/scm-ports.expSimon Marchi1-60/+54
Simplify things a bit using foreach_with_prefix. The only expected change is in the naming of tests. Change-Id: Icb5e55207e0209e0d44d9e7c16a2f5e11aa29017 Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-09-11testsuite, fortran: Fix regression due to fix for ifort's 'start' behaviorIjaz, Abdul B1-5/+5
Got a regression email due to merge of commit in CI config tcwg_gdb_check/master-aarch64 : https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=41439185cd0075bbb1aedf9665685dba0827cfec Begining of test "gdb.fortran/array-slices-bad.exp" was updated in above commit to start the test from running to line with tag "First Breakpoint" instead of "fortran_runto_main". Reason of the regression is shared libraries are still loaded after hitting the breakpoint as "nosharedlibrary" is already called before hitting the breakpoint. So now after this change test is updated accordingly to disable and unload shared libraries symbols after hitting the first breakpoint. Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-09-11gdb: c++ify btrace_target_infoMarkus Metzger4-149/+112
Following the example of private_thread_info and private_inferior, turn struct btrace_target_info into a small class hierarchy. Also merge btrace_tinfo_bts with btrace_tinfo_pt and inline into linux_btrace_target_info. Fixes PR gdb/30751.
2023-09-11gdb, btrace: move xml parsing into remote.cMarkus Metzger3-324/+317
The code is only used in remote.c and all functions can be declared static.
2023-09-10gdb/testsuite: fix gdb.arch/amd64-init-x87-values.exp on AMD CPUsSimon Marchi1-1/+1
I see the following failure when running this test on an AMD machine: p/x $fioff^M $24 = 0x0^M (gdb) FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: check post FLD1 value of $fioff The register that GDB calls fioff normally contains the address of the last instruction executed by the x87 unit. It is available through the FSAVE/FXSAVE/XSAVE instructions, at offset 0x8 of the FSAVE/FXSAVE/XSAVE area. You can read about it in the Intel manual [1] at section "10.5.1 FXSAVE Area" (and equivalent sections for FSAVE and XSAVE) or in the AMD manual [2] at section "11.4.4 Saving Media and x87 Execution Unit State". The test therefore expects that after executing the FLD1 instruction, the fioff register contains the address of the FLD1 instruction. However, the FXSAVE and XSAVE instructions (which the kernel uses to dump x87 register state which it provides GDB through ptrace) behave differently on AMD CPUs. In section "11.4.4.3 FXSAVE and FXRSTOR Instructions" of the AMD manual, we read: The FXSAVE and FXRSTOR instructions save and restore the entire 128-bit media, 64-bit media, and x87 state. These instructions usually execute faster than FSAVE/FNSAVE and FRSTOR because they do not normally save and restore the x87 exception pointers (last-instruction pointer, last data-operand pointer, and last opcode). The only case in which they do save the exception pointers is the relatively rare case in which the exception-summary bit in the x87 status word (FSW.ES) is set to 1, indicating that an unmasked exception has occurred. So, unless a floating point exception happened and that exception is unmasked in the x87 FPU control register (which isn't by default on Linux, from what I saw), the "last instruction address" register (or fioff as GDB calls it) will always be 0 on an AMD CPU. For this reason, I think it's fine to change the test to accept the value 0 - that's just how the processor works. I toyed with the idea of changing the test program to make it so the CPU would generate a non-zero fioff. That is by unmasking an FPU exception and executing an instruction to raise that kind exception. It worked, but then I would have to change the test more extensively, and it didn't seem to be worth it. [1] https://cdrdv2.intel.com/v1/dl/getContent/671200 [2] https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf Change-Id: If2e1d932f600ca01b15f30b14b8d38bf08a3e00b Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-09-11Automatic date update in version.inGDB Administrator1-1/+1
2023-09-10Automatic date update in version.inGDB Administrator1-1/+1
2023-09-09Automatic date update in version.inGDB Administrator1-1/+1
2023-09-09Make sure DW_CFA_advance_loc4 is in the same fragJinyang He1-1/+1
Do the same as commit b9d8f5601bcf in another place generating DW_CFA_advance_loc4. The idea behind commit b9d8f5601bcf was that when a DW_CFA_advance_loc4 of zero is seen in eh_frame_relax_frag and eh_frame_convert_frag we want to remove the opcode entirely, not just convert to a nop. If the opcode was split over two frags then a size adjustment would need to be done to the first frag, not just the second as is correct for other cases with split frags. This would complicate the eh relaxation. It's easier to ensure the frag is not split. * ehopt.c (check_eh_frame): Don't allow DW_CFA_advance_loc4 to be placed in a different frag to the rs_cfa.
2023-09-08Run 'black' on recent test caseTom Tromey1-0/+1
The auto-builders pointed out that I neglected to run 'black' after a rest testcase change. This patch fixes the oversight.
2023-09-08Set insn_type for branch instructions on aarch64Vladimir Mezentsev1-0/+6
gprofng uses insn_type in print_address_func(). But insn_type is always zero on aarch64. opcodes/ChangeLog: 2023-09-07 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * opcodes/aarch64-dis.c (print_insn_aarch64_word): Set insn_type for branch instructions.
2023-09-08gdb/doc: describe x87 registersSimon Marchi1-0/+19
While investigating this [1], I initially had no idea what register "fioff" stood for, making it difficult to map it to something in the Intel or AMD manuals. Similarly, I can imaging someone familiar with x87 to want to print the "x87 last instruction address", and have no clue that GDB makes it available as register "fioff". The names of the x87 state fields don't seem to be standardized, they even change between sections of the Intel manual (between the FSAVE, FXSAVE and XSAVE area descriptions). Add some details to the doc to help one map GDB register names to x87 state fields. [1] https://inbox.sourceware.org/gdb-patches/20230908022722.430741-1-simon.marchi@efficios.com/T/#u Change-Id: I0ea1eb648358e62da4aa87eea3515ee8a09f2762 Approved-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Pedro Alves <pedro@palves.net>
2023-09-08gdb/doc: rename "x86 Architecture-specific Issues" section to "x86"Simon Marchi1-3/+3
I'm looking to add some x86-specific information to the doc, but I find the naming of this section odd. It doesn't really talk about issues, it just gives generally useful information. Also, the sections about other architectures don't mention "issues", just the architecture name. Also, at least in the HTML version of the doc, the name is inconsistent between the main table of content, where it appears as "x86 Architecture-specific Issues", and the sub-table of contents of the "Architectures" section, where it appears as "i386". Rename the section to just "x86". Change-Id: I0a119ff1ab5e7b83c9afa3c3977eb085e88f52ca Approved-By: Eli Zaretskii <eliz@gnu.org>
2023-09-08aarch64: Remove unused functionRichard Sandiford1-7/+0
set_expected_error is no longer used. It has been replaced by more specific error messages.
2023-09-08[gdb/testsuite] Make gdb.dwarf2/dwzbuildid.exp more robustTom de Vries1-35/+35
I ran test-case gdb.dwarf2/dwzbuildid.exp with target board cc-with-gdb-index, and noticed that compilation failure for one exec prohibited testing of all execs. Fix this by restructuring the test-case, such that we have: ... PASS: gdb.dwarf2/dwzbuildid.exp: testname=ok: set debug-file-directory PASS: gdb.dwarf2/dwzbuildid.exp: testname=ok: print the_int UNSUPPORTED: gdb.dwarf2/dwzbuildid.exp: testname=mismatch: compilation failed UNSUPPORTED: gdb.dwarf2/dwzbuildid.exp: testname=fallback: compilation failed ... Tested on x86_64-linux.
2023-09-08[gdb/testsuite] Add kfail in gdb.dwarf2/dwzbuildid.expTom de Vries1-0/+7
When running test-case gdb.dwarf2/dwzbuildid.exp using target board readnow, I get: ... (gdb) file dwzbuildid-mismatch^M Reading symbols from dwzbuildid-mismatch...^M warning: File "dwzbuildid5.o" has a different build-id, file skipped^M could not find '.gnu_debugaltlink' file for dwzbuildid-mismatch^M (gdb) delete breakpoints^M (gdb) info breakpoints^M No breakpoints or watchpoints.^M (gdb) break -qualified main^M No symbol table is loaded. Use the "file" command.^M Make breakpoint pending on future shared library load? (y or [n]) n^M (gdb) FAIL: gdb.dwarf2/dwzbuildid.exp: mismatch: gdb_breakpoint: set breakpoint at main ... This is PR symtab/26797: when using readnow, a failure in reading the dwarf results in the minimal symbols not being available. Add a corresponding KFAIL. Tested on x86_64-linux.
2023-09-08[gdb/testsuite] Add aranges in gdb.dwarf2/dwzbuildid.expTom de Vries1-2/+9
While investigating the execs of gdb.dwarf2/dwzbuildid.exp using readelf I ran into a warning: ... $ readelf -w dwzbuildid-ok > READELF readelf: Warning: .debug_info offset of 0x2e in .debug_aranges section does not point to a CU header. ... AFAICT, the warning is incorrect, I've filed PR binutils/30835 about that. While looking at the .debug_aranges section, I noticed that the entries for the CUs generated by the dwarf assembler are missing. Fix this by adding the missing .debug_aranges entries. Tested on x86_64-linux.
2023-09-08[gdb/testsuite] Fix build-ids in gdb.dwarf2/dwzbuildid.expTom de Vries1-3/+3
When looking at the execs from test-case gdb.dwarf2/dwzbuildid.exp using readelf, I run into: ... $ readelf -w dwzbuildid-ok > READELF readelf: Warning: Corrupt debuglink section: .gnu_debugaltlink readelf: Warning: Build-ID is too short (0x6 bytes) ... Fix this by ensuring the Build-IDs are the required 20 bytes. Tested on x86_64-linux.
2023-09-08gdb/testsuite: fix gdb.mi/mi-condbreak-throw.exp failureAndrew Burgess1-2/+1
In commit: commit 3ce8f906be7a55d8c0375e6d360cc53b456d86ae Date: Tue Aug 8 10:45:20 2023 +0100 gdb: MI stopped events when unwindonsignal is on a new test, gdb.mi/mi-condbreak-throw.exp, was added. Unfortunately, this test would fail when using the native-gdbserver board (and other similar boards). The problem was that one of the expected output patterns included some output from the inferior. When using the native-gdbserver board, this output is not printed to GDB's tty, but is instead printed to gdbserver's tty, the result is that the expected output no longer matches, and the test fails. Additionally, as the output is actually from the C++ runtime, rather than the test's source file, changes to the C++ runtime could cause the output to change. To solve both of these issues, in this commit, I'm removing the reference to the inferior's output, and replacing it with '.*', which will skip the output if it is present, but is equally happy if the output is not present. After this commit gdb.mi/mi-condbreak-throw.exp now passes on all boards, including native-gdbserver.
2023-09-08x86: restrict prefix use with .insn VEX/XOP/EVEXJan Beulich1-0/+23
Avoid triggering the respective abort() in output_insn().
2023-09-07gdb: remove interp_supports_command_editingSimon Marchi3-14/+2
It is a trivial wrapper around the supports_command_editing method, remove it. Change-Id: I0fe3d7dc69601b3b89f82e055f7fe3d4af1becf7 Approved-By: Tom Tromey <tom@tromey.com>
2023-09-07gdb: remove interp_pre_command_loopSimon Marchi4-16/+2
It is a trivial wrapper around the pre_command_loop method, remove it. Change-Id: Idb2c61f9b68988528006a9a9b2b528f43781eef4 Approved-By: Tom Tromey <tom@tromey.com>
2023-09-08Automatic date update in version.inGDB Administrator1-1/+1
2023-09-08testsuite, fortran: make kfail gfortran specificNils-Christian Kempke1-1/+3
The modified test in function-calls.exp actually passes with ifort and ifx. The particular fail seems to be specific to gfortran. When the test was introduced it was only tested with gfortran (actually the whole patch was written with gfortran and the GNU Fortran argument passing convention in mind). Approved-by: Tom Tromey <tom@tromey.com>
2023-09-08testsuite, fortran: adapt tests for ifort's 'start' behaviorNils-Christian Kempke2-16/+8
The modified tests array-slices-bad.exp and vla-type.exp both set a breakpoint at the first real statement in the respective executables. Normally, the expected behavior of fortran_runto_main for these would be the stopping of the debugger at exactly the first statment in the code. Strangely, neither gfortran nor ifx seem to do this for these tests. Instead, issuing 'start' in ifx (for either of the 2 tests) lets GDB stop at the 'program ...' line and gfortran stops at a variable declaration line. E.g. for vla-type it stops at 41 type(five) :: fivearr (2) So, actually, ifort's behavior can be considered to be a bit more 'correct' here. This patch remove the fortran_runto_main in the two tests and instead uses runto to directly run to the first breakpoint set at the first program statement. This works with both compiler behaviors and makes the tests more robust. Approved-by: Kevin Buettner <kevinb@redhat.com>
2023-09-08testsuite, fortran: Remove self assignment non-statementsNils-Christian Kempke3-7/+8
There were a couple of places in the testsuite where instructions like var = var were written in the source code of tests. These were usually dummy statements meant to generate a line table entry at that line on which to break later on. This worked fine for gfortran and ifx, but it seems that, when compiled with ifort (2021.6.0) these statements do not actually create any assmbler instructions and especially no line table entries. Consider the program program test Integer var :: var = 1 var = var end program compiled with gfortran (13.0.0, -O0 -g). The linetable as emitted by 'objdump --dwarf=decodedline ./a.out' looks like test.f90: File name Line number Starting address View Stmt test.f90 1 0x401172 x test.f90 3 0x401176 x test.f90 4 0x401182 x test.f90 4 0x401185 x test.f90 4 0x401194 x test.f90 - 0x4011c0 actually containing line table info for line 3. Running gdb, breaking at 3 and checking the assembly we see 0x0000000000401172 <+0>: push %rbp 0x0000000000401173 <+1>: mov %rsp,%rbp => 0x0000000000401176 <+4>: mov 0x2ebc(%rip),%eax # 0x404038 <var.1> 0x000000000040117c <+10>: mov %eax,0x2eb6(%rip) # 0x404038 <var.1> 0x0000000000401182 <+16>: nop 0x0000000000401183 <+17>: pop %rbp 0x0000000000401184 <+18>: ret so two mov instructions are being issued for this assignment one copying the value into a register and one writing it back to the same memory. Ifort (2021.6.0, -O0 -g) on the other hand does not emit anything here and also has no line table entry: test.f90: File name Line number Starting address View Stmt test.f90 1 0x4040f8 x test.f90 4 0x404109 x test.f90 4 0x40410e x test.f90 - 0x404110 As I do not think that this is really a bug (on either side, gfortran/ifx or ifort), and as I don't think this behavior is covered in the Fortran standard, I changed these lines to become actual value assignments. This removes a few FAILs in the testsuite when ran with ifort. Approved-by: Tom Tromey <tom@tromey.com>
2023-09-08testsuite, fortran: make mixed-lang-stack less compiler dependentNils-Christian Kempke1-1/+8
In the gdb.fortran/mixed-lang-stack.exp test when somewhere deep in a bunch of nested function calls we issue and test a 'info args' command for the mixed_func_1b function (when in that function's frame). The signature of the function looks like subroutine mixed_func_1b(a, b, c, d, e, g) use type_module implicit none integer :: a real(kind=4) :: b real(kind=8) :: c complex(kind=4) :: d character(len=*) :: e character(len=:), allocatable :: f TYPE(MyType) :: g and usually one would expect arguments a, b, c, d, e, and g to be emitted here. However, due to some compiler dependent treatment of the e array the actual output in the test (with gfortran/ifx) is (gdb) info args a = 1 b = 2 c = 3 d = (4,5) e = 'abcdef' g = ( a = 1.5, b = 2.5 ) _e = 6 where the compiler generated '_e' is emitted as the length of e. While ifort also generates an additional length argument, the naming (which is up to the compilers here I think, I could not find anything in the Fortran standard about this) is different and we see (gdb) info args a = 1 b = 2 c = 3 d = (4,5) e = 'abcdef' g = ( a = 1.5, b = 2.5 ) .tmp.E.len_V$4a = 6 To make both outputs pass the test, I kept the additional argument for now and made the regex for the emitted name of the last variable match any arbitrary name. Approved-by: Tom Tromey <tom@tromey.com>
2023-09-08gdb: add Abdul Basit Ijaz to gdb/MAINTAINERSIjaz, Abdul B1-0/+1
Signed-off-by: Ijaz, Abdul B <abdul.b.ijaz@intel.com>
2023-09-08kvx: Add a testcase for bundles with KVXMAXBUNDLEWORDS syllablesPaul Iannetta3-0/+53
* testsuite/gas/kvx/fat-bundles.s: New test. * testsuite/gas/kvx/kv3-1-fat-bundles.d: New test. * testsuite/gas/kvx/kv3-2-fat-bundles.d: New test.
2023-09-08PR30793, kvx_reassemble_bundle index 8 out of boundsAlan Modra1-46/+29
While the patch already committed for pr30793 prevents the asan error, there is a problem: Now the last element of bundle_words never gets written. That's very likely wrong, or KVXMAXBUNDLEWORDS is too big. So this patch rearranges things a little to support writing of all of bundle_words and does the parallel bit checking only when filling bundle_words. In the normal case, kvx_reassemble_bundle will see bundle_words[word_count-1] with the parallel bit clear and all other words having it set. In the error case where all words in bundle_words have the parallel bit set, kvx_reassemble_bundle will be passed a wordcount of KVXMAXBUNDLEWORDS + 1. I've also made kvx_reassemble_bundle return true for success rather than zero, and removed the unnecessary check for zero wordcount. PR 30793 * kvx-dis.c (kvx_reassemble_bundle): Return bool, true on success. Fail if wordcount is too large. Don't check for wordcount zero. Don't check kvx_has_parallel_bit. (print_insn_kvx): Rewrite code reading bundle_words as a for loop. Don't stop reading at KVXMAXBUNDLEWORDS - 1. (decode_prologue_epilogue_bundle): Similarly.
2023-09-07Fix bug in -var-evaluate-expressionTom Tromey4-1/+26
This bug points out that if one uses -var-set-visualizer with "None" -- to disable a pretty-printer for a varobj -- then -var-evaluate-expression will still use pretty-printing. This is a combination of bugs. First, setting the visualizer does not update the display text; and second, computing the display text should use "raw" when Python is available but no visualizer is desired. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11738 Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-09-07Remove variable_default_displayTom Tromey1-11/+1
variable_default_display has a single caller now, so remove it. Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-09-07Remove dead code from varobj_set_display_formatTom Tromey1-14/+1
varobj_set_display_format takes an enum and exhaustively switches on the values -- but also has a default. This default case is dead code. Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-09-07Allow pretty-printer 'children' method to return stringsTom Tromey4-0/+113
A user noticed that, while a pretty-printer can return Python strings from its "children" method, this does not really work for MI. I tracked this down to my_value_of_variable calling into c_value_of_variable, which specially handles arrays and structures -- not using the actual contents of the string. Now, this part of MI seems bad to me, but rather than change that, this applies the fix to only dynamic varobjs, which is the only scenario where a string like this can really be returned. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18282 Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-09-07[gdb/symtab] Fix gdb-index writing for .debug_typesTom de Vries1-7/+3
With test-case gdb.ada/same_enum.exp and target board dwarf4-gdb-index we run into: ... (gdb) print red^M No definition of "red" in current context.^M (gdb) FAIL: gdb.ada/same_enum.exp: print red ... [ This is a regression since commit 844a72efbce ("Simplify gdb_index writing"), so this is broken in gdb 12 and 13. ] The easiest way to see what's going wrong is with readelf. We have in section .gdb_index: ... [7194] pck__red: 2 [static, variable] 3 [static, variable] ... which points to the CUs 2 and 3 in the CU list (shown using "2" and "3"), but should be pointing to the TUs 2 and 3 in the TU list (shown using "T2" and "T3"). Fix this by removing the counter / types_counter distinction in write_gdbindex, such that we get the expected: ... [7194] pck__red: T2 [static, variable] T3 [static, variable] ... [ While reading write_gdbindex I noticed a few oddities related to dwz handling, I've filed PR30829 about this. ] Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR symtab/30827 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30827
2023-09-07[gdb/ada] Extend type equivalence test in ada_resolve_enumTom de Vries1-3/+18
When running test-case gdb.ada/local-enum.exp with target board debug-types, I run into: ... (gdb) print v1(three)^M No name 'three' in enumeration type 'local__e1'^M (gdb) FAIL: gdb.ada/local-enum.exp: print v1 element ... The array V1 is of type A1 which is an array with index type E1, containing "three" as enumerator: ... type E1 is (one, two, three); type A1 is array (E1) of Integer; V1 : A1 := (0, 1, 2); ... There's also a type E2 that contains three as enumerator: ... type E2 is (three, four, five); ... When doing "print v1(three)", it's the job of ada_resolve_enum to resolve "three" to type E1 rather than type E2. When using target board debug-types, the enums E1 and E2 are replicated in the .debug_types section, and consequently in ada_resolve_enum the type equivalence check using a pointer comparison fails: ... for (int i = 0; i < syms.size (); ++i) { /* We already know the name matches, so we're just looking for an element of the correct enum type. */ if (ada_check_typedef (syms[i].symbol->type ()) == context_type) return i; } ... Fix this by also trying a structural comparison using ada_identical_enum_types_p. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR ada/29335 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29335
2023-09-07[gdb/ada] Move identical enums handling laterTom de Vries2-15/+22
When running test-case gdb.ada/arr_acc_idx_w_gap.exp with target board cc-with-dwz, I run into: ... (gdb) print enum_with_gaps'enum_rep(lit3)^M 'Enum_Rep requires argument to have same type as enum^M (gdb) FAIL: gdb.ada/arr_acc_idx_w_gap.exp: enum_rep ... With target_board unix, we have instead: ... (gdb) print enum_with_gaps'enum_rep(lit3)^M $16 = 13^M (gdb) PASS: gdb.ada/arr_acc_idx_w_gap.exp: enum_rep ... Conversely, when I add this test to the test-case: ... gdb_test "print enum_with_gaps'enum_rep(lit3)" " = 13" \ "enum_rep" + gdb_test "print enum_subrange'enum_rep(lit3)" " = 13" \ + "other enum_rep" ... the extra test passes with target board cc-with-dwz, but fails with target board unix. The problem is here in remove_extra_symbols: ... if (symbols_are_identical_enums (syms)) syms.resize (1); ... where one of the two identical enums is picked before the enum_rep handling can resolve lit3 to one of the two. Fix this by moving the code to ada_resolve_variable. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR ada/30726 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30726
2023-09-07Simplify block_find_symbolTom Tromey4-75/+27
block_find_symbol takes a callback function, but only two callbacks are ever passed to it -- and they are similar enough that it seems cleaner to just have block_find_symbol do the work itself. Also, block_find_symbol can take a lookup_name_info as an argument, following the general idea of pushing the construction of these objects as high in the call chain as feasible. Regression tested on x86-64 Fedora 38. Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2023-09-07gdb/mi: make current_token a field of mi_interpSimon Marchi4-14/+19
Following the commit f818c32ba459 ("gdb/mi: fix ^running record with multiple MI interpreters"), I thought it would make sense to make current_token a field of mi_interp. This variable contains the token of the currently handled MI command, like the 222 in: 222-exec-continue I didn't find any bug related to that, it's just a "that seems nicer" cleanup, since the current token is a fundamentally per-interp thing. mi_execute_command needs a check similar to what we already have in mi_cmd_gdb_exit: when invoked from Python's gdb.execute_mi, the current interpreter is not an mi_interp. When using the Python gdb.execute_mi function, there is no such concept of token, so we can just skip that. There should be no user-visible change. Change-Id: Ib52b3c0cba4b7c9d805b432c809692a86e4945ad Approved-By: Tom Tromey <tom@tromey.com>
2023-09-07gdb: fix indentation in mi/mi-parse.hSimon Marchi1-59/+59
Change-Id: Ib841a77a9494648aee9f970141424363664ff6e8
2023-09-07Add testcase for generation of 32/64_PCREL.cailulu4-0/+204
2023-09-07Use 32/64_PCREL to replace a pair of ADD32/64 and SUB32/64.cailulu2-12/+22
Subtraction for labels that require static relocation usually generates ADD32/64 and SUB32/64. If subsy of BFD_RELOC_32/64 and PC in same segment, and disable relax or PC at start of subsy or enable relax but not in SEC_CODE, we generate 32/64_PCREL to replace a pair of ADD32/64 and SUB32/64.
2023-09-07RISC-V: Clarify the naming rules of vendor operands.Nelson Chu5-233/+250
The vendor operands should be named starting with `X', and preferably the second letter (or multiple following letters) is enough to differentiate them from other vendors. Therefore, added letter `t' after `X' for t-head operands, to differentiate from future different vendor's operands. bfd/ * elfxx-riscv.c (riscv_supported_vendor_x_ext): Removed the vendor document link since it should already be recorded in the gas/doc/c-riscv.texi. gas/ * config/tc-riscv.c (validate_riscv_insn): Added `t' after `X' for t-head operands. Minor updates for indents and comments. (riscv_ip): Likewise. * doc/c-riscv.texi: Minor updates. opcodes/ * riscv-dis.c (print_insn_args): Added `t' after `X' for t-head operands. Minor updates for indents and comments. * riscv-opc.c (riscv_opcode): Likewise.
2023-09-06gold: Use char16_t, char32_t instead of uint16_t, uint32_t as character typesRoland McGrath4-6/+22
The std::basic_string template type is only specified for instantiations using character types. Newer (LLVM) libc++ implementations no longer allow non-character integer types to be used. gold/ * output.cc: Include <uchar.h>. (Output_section::add_merge_input_section): Use char16_t and char32_t for 2- and 4-byte entry size, respectively. * stringpool.cc: Include <uchar.h>. (Stringpool_template): Explicitly instantiate for char16_t, char32_t instead of uint16_t, uint32_t. * merge.cc (Output_merge_string): Likewise.
2023-09-07Automatic date update in version.inGDB Administrator1-1/+1