aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-07HP-PA: use is_end_of_stmt()Jan Beulich1-3/+3
... instead of open-coding it.
2025-03-07dlx: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07C-Sky: use is_end_of_stmt()Jan Beulich1-8/+8
... instead of open-coding it.
2025-03-07cris: use is_end_of_stmt()Jan Beulich1-1/+1
Fix use of is_end_of_line[] directly instead of through the is_end_of_stmt() macro.
2025-03-07aarch64: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07Arm: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it. This also fixes an array underrun issue: The wrong casting to plain int could have yielded negative values when plain char is a signed type.
2025-03-07Alpha: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it. Note that writes to the array need to be left alone; they can only be converted when the array is folded into lex_type[].
2025-03-07Mach-O: use is_end_of_stmt()Jan Beulich1-4/+4
... instead of open-coding it.
2025-03-07ELF: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it.
2025-03-07{,E}COFF: use is_end_of_stmt()Jan Beulich2-3/+3
... instead of open-coding it. Convert a variable's type to plain char then as well, as that's what it's really holding (and how it's used everywhere else).
2025-03-07gprof: Update PR gprof/32764 testH.J. Lu6-5/+5
1. Remove gmon.out first before generating it in the configure check. 2. Make tst-gmon-gprof.out depend on the gprof binary. 3. Check that gmon.out is non-empty. 4. Don't include <sys/cdefs.h> in tst-gmon.c. PR gprof/32764 * configure.ac: Remove gmon.out first. * configure: Regenerated. * testsuite/Makefile.am (tst-gmon-gprof.out): Depend on $(GPROF). * testsuite/Makefile.in: Regenerated. * testsuite/tst-gmon-gprof.sh: Check that gmon.out is non-empty. * testsuite/tst-gmon.c: Don't include <sys/cdefs.h>. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-07RISC-V: Go PLT for CALL/JUMP/RVC_JUMP if `h->plt.offset' isn't -1Nelson Chu1-40/+44
I got an request about the undefined behaviors, considering the following case, $ cat test.c void main () { foo(); } $ cat lib.h void foo(void); $ riscv64-unknown-linux-gnu-gcc test.c riscv64-unknown-linux-gnu/bin/ld: /tmp/ccRO8fJl.o: in function `main': test.c:(.text+0x8): undefined reference to `foo' collect2: error: ld returned 1 exit status $ riscv64-unknown-linux-gnu-gcc test.c -Wl,--unresolved-symbols=ignore-in-object-files $ qemu-riscv64 a.out Segmentation fault (core dumped) Testing with x86 and aarch64, they won't get the segfault since they go plt for the undefined foo symbol. So, after applying this patch, I can get the following too, $ qemu-riscv64 a.out a.out: symbol lookup error: a.out: undefined symbol: foo The change of this patch should only affect the call behavior, which refer to an undefined (weak) symbol, when building an dynamic executable. I think the pic/pie behavior won't be affected as usual.
2025-03-07gprof: Copy a simple test from glibcH.J. Lu8-7/+1102
Copy a simple gprof test from glibc to test the basic gprof functionality. 1. Tested natively on Linux/x86-64 and Linux/i686. 2. Tested for the x86_64-solaris cross target without cross-compiler. 3. Tested for the aarch64-linux-gnu cross target with cross-compiler. PR gprof/32764 * Makefile.am (SUBDIRS): Add testsuite * configure.ac (AC_CONFIG_FILES): Removed. (AC_OUTPUT): Add Makefile testsuite/Makefile po/Makefile.in:po/Make-in. (AM_CONDITIONAL): Add NATIVE. * Makefile.in: Regenerated. * configure: Likewise. * testsuite/Makefile.am: New file. * testsuite/tst-gmon-gprof.sh: Likewise. * testsuite/tst-gmon.c: Likewise. * testsuite/Makefile.in: Generated. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-07Automatic date update in version.inGDB Administrator1-1/+1
2025-03-07Re: ld: Add a test for PR ld/25237Alan Modra2-28/+0
Delete the test. It doesn't make sense to check a linker hack for a meaningless p_offset.
2025-03-06[gdb] Fix typos in NEWSTom de Vries1-12/+12
Fix typos: ... mainenance ==> maintenance epilgoue ==> epilogue commnds ==> commands readibility ==> readability informations ==> information throwed ==> threw compiletime ==> compile time namepace ==> namespace reqired ==> required explicity ==> explicitly reqired ==> required ...
2025-03-06[gdb/python] Fix typosTom de Vries3-5/+5
Fix typos: ... gdb/python/py-framefilter.c:749: indention ==> indentation gdb/python/py-framefilter.c:837: indention ==> indentation gdb/python/py-lazy-string.c:35: sting ==> string gdb/python/py-progspace.c:119: Retun ==> Return gdb/python/py-progspace.c:139: Retun ==> Return ...
2025-03-06[gdb/python] Fix typos in libTom de Vries2-2/+2
Fix typos: ... gdb/python/lib/gdb/disassembler.py:84: dissables ==> disables gdb/python/lib/gdb/command/xmethods.py:40: experession ==> expression ...
2025-03-06[gdb/guile] Fix typosTom de Vries2-2/+2
Fix typos: ... gdb/guile/scm-lazy-string.c:41: sting ==> string gdb/guile/lib/gdb/iterator.scm:65: satify ==> satisfy ...
2025-03-06[gdb/doc] Fix typos in gdb.texinfoTom de Vries1-4/+4
Fix typos: ... preprend -> prepend wth -> with Connnections -> Connections ...
2025-03-06[gdb/doc] Fix typos in annotate.texinfoTom de Vries1-2/+2
Fix typos: ... Dependant ==> Dependent ...
2025-03-06[gdb/doc] Fix typos in python.texiTom de Vries1-3/+3
Fix typos: ... atribute ==> attribute ...
2025-03-06[gdb/nat] Fix typosTom de Vries2-2/+2
Fix typos: ... exising ==> existing afer ==> after ...
2025-03-06[gdb/tui] Fix typosTom de Vries2-2/+2
Fix typos: ... gdb/tui/tui.c:64: releated ==> related gdb/tui/tui-io.c:50: releated ==> related ...
2025-03-06[gdb/cli] Fix typosTom de Vries2-2/+2
Fix typos: ... gdb/cli/cli-utils.h:85: fuction ==> function gdb/cli/cli-decode.c:2457: Ambigous ==> Ambiguous ...
2025-03-06[gdb] Fix typos in gdbarch_components.pyTom de Vries2-10/+10
Fix typos in gdbarch_components.py: ... tranformations ==> transformations charater ==> character Noe -> Note ... and regenerate gdb/gdbarch-gen.h.
2025-03-06Update ada_add_block_renamings for compiler changesTom Tromey1-12/+23
With the hierarchical name patches to GNAT, ada_add_block_renamings must now be updated as well -- the comment there about the supported forms of DW_TAG_imported_declaration is no longer correct, and now full names must sometimes be constructed during the lookup process.
2025-03-06Add support for hierarchical Ada namesTom Tromey2-33/+134
In the near future, GNAT will start emitting DWARF names in a more standard way -- specifically, the package structure will be indicated by nested DW_TAG_module DIEs and a given entity will be nested in its package and only have a simple name. This patch changes gdb to understand this style of naming, while still supporting the existing GNAT output. A few special cases are needed. I've commented them. The name-computing code for the full DWARF reader is very complicated -- much too complicated, in my opinion. There are already several bugs in bugzilla about this (search for "physname"... but there are others as well), so I haven't filed any new ones. When I started this project, I thought it would solve some memory overuse issues we sometimes see from how the index-sharding code interacts with the GNAT-specific post-pass. However, to my surprise, the Ada code in gdb relies on some details of symbol naming, and so I've had to add code here to synthesize "linkage" names in some cases. This is unfortunate, but I think can eventually be fixed; I will file a bug to track this issue.
2025-03-06Add "Ada linkage" mode to cooked_index_entry::full_nameTom Tromey2-10/+26
Unfortunately, due to some details of how the Ada support in gdb currently works, the DWARF reader will still have to synthesize some "full name" entries after the cooked index has been constructed. You can see one particular finding related to this in: https://sourceware.org/bugzilla/show_bug.cgi?id=32142 This patch adds a new flag to cooked_index_entry::full_name to enable the construction of these names. I hope to redo this part of the Ada support eventually, so that this code can be removed and the full-name entries simply not created.
2025-03-06Store new Ada entries in cooked_index_shard::m_entriesTom Tromey2-8/+21
handle_gnat_encoded_entry might create synthetic cooked index entries for Ada packages. These aren't currently kept in m_entries, but it seems to me that they should be, particularly because a forthcoming GNAT will emit explicit DW_TAG_module for these names -- with this change, the indexes will be roughly equivalent regardless of which compiler was used.
2025-03-06Handle DW_TAG_module for AdaTom Tromey1-8/+19
This updates read_module_type to turn DW_TAG_module into a TYPE_CODE_NAMESPACE when the CU represents Ada code. Note that the GNAT that generates this isn't generally available yet and so this shouldn't have an impact on current code.
2025-03-06Add "synthetic" marker for index entriesTom Tromey3-9/+11
Currently, gdb will synthesize DW_TAG_module entries for Ada names. These entries are treated specially by the index writer, When GNAT starts emitting DW_TAG_module, the special case will be incorrect, because there will be non-synthetic DW_TAG_module entries in the index. This patch arranges to mark the synthetic entries and changes the index writer to follow.
2025-03-06Use DW_TAG_module for AdaTom Tromey3-3/+6
In GCC we decided to use DW_TAG_module to represent Ada packages, so make this same decision in gdb. This also updates tag_matches_domain to handle this case.
2025-03-06Use dwarf2_full_name when computing type namesTom Tromey1-4/+5
This changes a few spots in the DWARF reader to use dwarf2_full_name when computing the name of a type. This gives the correct name when a type is nested in a namespace. This oddity probably wasn't noticed before because some of the types in question are either normally anonymous in C++ (e.g, array type) or do not appear in a namespace (base type).
2025-03-06Compare unqualified names in ada_identical_enum_types_pTom Tromey1-11/+21
With the coming changes to GNAT, gdb must compare the unqualified names of two enum types. Currently, GNAT will fully-qualify enumeration constant names, so for instance one might see "enum_with_gap__lit4" as the name. GNAT also may emit a copy of an enumeration type when a newtype is involved. E.g., in the arr_acc_idx_w_gap.exp test case, this can occur for the base type of this subtype: type Enum_Subrange is new Enum_With_Gaps range Lit1 .. Lit3; (Note that the base type of this subrange is anonymous.) With some forthcoming changes to GNAT, these names will no longer be qualified -- and because the newtype is anonymous, they can't be identically qualified. But, in gdb we still want "lit4" to resolve without ambiguity in this scenario. The fix is to change ada_identical_enum_types_p to compare unqualified enum names. This will work correctly with both variants of the compiler, and with -fgnat-encodings=all as well.
2025-03-06Use ada_identical_enum_types_p in ada_atr_enum_repTom Tromey1-1/+8
With the coming changes to GNAT, we may see two distinct but equivalent enum types in the DWARF. In this case, it's better to use ada_identical_enum_types_p rather than types_equal when comparing these types... something that matters when using 'Enum_Rep.
2025-03-06Fixes to gdb.ada/fun_overload_menu.expTom Tromey2-19/+28
This patch applies a few fixes to gdb.ada/fun_overload_menu.exp. It adds some comments to the source and uses this to extract line numbers. This is used to ensure that two otherwise-equivalent results are in fact different, so that the test really checks that the result is correct. It also changes the test_menu proc to accept a list of possible results. This lets the test work regardless of the order in which the menu items are presented by gdb. Finally, like an earlier patch, it changes the test to optionally accept unqualified names from gdb.
2025-03-06Allow multiple locations in homonym.expTom Tromey1-1/+1
With some forthcoming changes to GNAT, the two Get_Value functions in this test case will end up with the same name (with the current GNAT, one ends up with a "__2" suffix). This change will cause one test to set multiple breakpoints; this patch changes the test to work with either version of the compiler.
2025-03-06Fix type name in ptype-o.expTom Tromey3-10/+28
The "Rec" type in ptype-o.exp is currently named "prog__rec" by the compiler. However, with my changes to GNAT, the type will no longer have a prefix, as it is local to a procedure. Changing this to just use "rec" works fine with the new compiler, but then fails with older compilers. To allow correct operation with both compilers, this patch simply moves the type into a new package. This doesn't affect the meaning of the test, which is just ensuring that ptype/o works in a certain case. Note that the more obvious fix of just using "ptype/o rec" does not work with the current GNAT. I haven't investigated this but I did file a bug to track it: https://sourceware.org/bugzilla/show_bug.cgi?id=32169
2025-03-06Allow unqualified names in Ada testsTom Tromey14-28/+47
Currently, when a type is declared in a subprogram that isn't part of a package, gdb will give this type a qualified name. E.g., in the program for gdb.ada/arr_arr.exp: procedure Foo is type Array2_First is array (24 .. 26) of Integer; gdb will name this type 'foo.array2_first'. However, with some coming changes to GNAT (and with the remainder of this series applied as well), this will no longer happen. Instead, such types will be given their local name. IMO this makes more sense anyway. This patch updates most of the Ada tests to allow either form in the spots where it matters. Both are accepted so that the tests continue to work with older versions of GNAT. (A few tests are handled in separate patches; this patch only contains the straightforward changes.)
2025-03-06Fix latent crash in ada_variant_discrim_nameTom Tromey1-2/+4
ada_variant_discrim_name does this: for (discrim_end = name + strlen (name) - 6; discrim_end != name; If NAME is too short, this will construct an invalid pointer, perhaps causing a crash. This patch arranges to check the length first.
2025-03-06Allow for anonymous Ada enumeration typesTom Tromey1-1/+4
With some forthcoming changes to GNAT, gdb might see a nameless enum in ada_resolve_enum, causing a crash. This patch allows an anonymous enum type to be considered identical to a named type when the contents are identical.
2025-03-06Add a quit to maint_print_all_sectionsTom Tromey1-0/+3
If you have many sections, "maint print sections" can take a very long time (due to a bug). If you happen to "c" at the pagination prompt, this can't be interrupted. This patch adds a QUIT to the loop to at least allow interruption. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32758 Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
2025-03-06[gdbserver] Drop abbreviations in gdbserver/xtensa-xtregs.ccTom de Vries1-2/+18
In gdbserver/xtensa-xtregs.cc, there's a table: ... const xtensa_regtable_t xtensa_regmap_table[] = { /* gnum,gofs,cpofs,ofs,siz,cp, dbnum, name */ { 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" }, { 0 } }; ... on which codespell triggers: ... $ codespell --config ./gdbserver/setup.cfg gdbserver gdbserver/xtensa-xtregs.cc:34: siz ==> size, six ... Fix this by laying out the table in vertical fashion, and using the full field names instead of the abbreviations ("size" instead of "siz", "offset" instead of "ofs", etc). Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-03-06Use 'const' in some gdbarch methodsTom Tromey9-20/+24
This changes a couple of gdbarch methods to use 'const' for an "asymbol *" parameter. These methods shouldn't be modifying the underlying symbol in the BFD. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-03-06[gdbserver] Add codespell section in setup.cfgTom de Vries1-0/+4
Add a codespell section in new config file gdbserver/setup.cfg, similar to the one in gdbsupport/setup.cfg. There's just one item left: ... $ codespell --config ./gdbserver/setup.cfg gdbserver gdbserver/xtensa-xtregs.cc:34: siz ==> size, six ...
2025-03-06gdb/dwarf: remove unnecessary `this->` in read.cSimon Marchi1-45/+44
I like using `this->` when it's unclear that the method or field accessed is within the current class, but when accessing a private member prefixed with `m_`, it's unnecessary, as the prefix makes it clear. Remove some instances of it (some coming from the previous patch, other pre-existing) to de-clutter the code a bit. Change-Id: Ia83d0bce51d222fa3ac3d756d50170ec6ed12b94 Approved-By: Tom Tromey <tom@tromey.com>
2025-03-06gdb/dwarf: make all fields of cutu_reader privateSimon Marchi1-272/+279
Make all fields of cutu_reader private, then add getters for whatever needs to be accessed outside of cutu_reader. This should help spot what's used by cutu_reader itself, and what is used by others. Change-Id: I71cb73fffa5d70cc9c7fc68bf74db937e84c2db1 Approved-By: Tom Tromey <tom@tromey.com>
2025-03-06gdb/dwarf: pass dwarf2_cu instead of cutu_reader to two functionsSimon Marchi1-7/+4
These functions don't need to receive a cutu_reader, they only use it to obtain the contained dwarf2_cu, so change them to accept a dwarf2_cu. This helps reduce the creep of cutu_reader a little bit. Change-Id: Iebb3c4697a4aec638b47423b3ac59077d4fa5090 Approved-By: Tom Tromey <tom@tromey.com>
2025-03-06gdb/dwarf: move a bunch of DIE-reading functions to cutu_readerSimon Marchi1-153/+154
With the hope of organizing things better and spotting patterns that could lead to simplification, move all these functions to be methods of cutu_reader. At least, this gives a good picture of what the entry points for DIE and attribute reading are, by looking at what methods are public. Right now, my vague understanding of cutu_reader is that it does 3 things: - it provides means to navigate and read the DIE tree, abstracting things like whether the real content is in a DWO file or not - it builds a dwarf2_cu object, for its own use but also for the use of the caller - it fills in missing details in the passed in dwarf2_per_cu In the future, I'd like to separate those concerns. I think that cutu_reader could retain the first one of those concerns, while the other two could be done by other classes or functions, perhaps using cutu_reader under the hood. Change-Id: I04e0d6c864bbc09c7071ac8e9493e1e54c093d68 Approved-By: Tom Tromey <tom@tromey.com>