aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-05-16ubsan: emit_inc_line_addr integer overflowAlan Modra1-1/+1
Commit 07cf922195d1 fixed the one in size_inc_line_addr. Silly me missed the identical overflow in emit_inc_line_addr
2025-05-16gas .align limitAlan Modra1-5/+11
At the moment we allow alignment of up to half the address space, which is stupidly large and results in OOM on x86_64. Change that to 1G alignment in text sections. Also fix the warning message on exceeding max allowed alignment. * read.c (TC_ALIGN_LIMIT): Limit to 30 in text sections. (s_align): Correct "alignment too large" value.
2025-05-16ld testsuite fail with --disable-pluginsAlan Modra1-6/+7
* testsuite/config/default.exp (dep_plug_opt): Don't set unless check_plugin_api_available returns true.
2025-05-16gas: adjust a comparison in s_align()Jan Beulich1-1/+1
In 344b1e0f5f79 ("gas: range-check 3rd argument of .align et al") I neglected to consider compilers which warn about signed/unsigned mismatches in comparisons (which is somewhat odd when the signed value is already known to be non-negative).
2025-05-16gas: range-check 3rd argument of .align et alJan Beulich1-1/+7
Negative values would have been silently converted to large positive ones, which may not be the user's intention. Similarly overly large values would have been silently truncated. Warn them instead, and zap such values.
2025-05-16ld/doc: Remove '.info' suffix in @ref, etcCollin Funk1-2/+2
Texinfo 7.2 began showing warnings like: ld.texi:1026: warning: do not set .info suffix in reference for manual `gcc.info' ld.texi:9689: warning: do not set .info suffix in reference for manual `binutils.info' The Texinfo developers plan to stop removing the '.info' suffix internally in a future release so without this patch the references will break in the future. Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-05-16binutils/doc: Remove '.info' suffix in @ref, etcCollin Funk1-2/+2
Texinfo 7.2 began showing warnings like: binutils.texi:882: warning: do not set .info suffix in reference for manual `ld.info' binutils.texi:1365: warning: do not set .info suffix in reference for manual `ld.info' The Texinfo developers plan to stop removing the '.info' suffix internally in a future release so without this patch the references will break in the future. Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-05-16x86: improve matching diagnostics when %st is involvedJan Beulich8-7440/+7476
Diagnosing operand size vs operand type mismatches doesn't work very well when GPRs and FPRs are in the same register class, distinguished just by size. Introduce a separate RegFP class.
2025-05-16x86: move Anysize check in operand_size_match()Jan Beulich1-5/+1
Anysize is applicable to memory operands only. Move the check to where memory operands are handled. (The RegSIMD part there was questionable altogether.)
2025-05-16x86: improve matching diagnostics when "accumulator" registers are involvedJan Beulich3-3/+40
In templates, the expectation of an "accumulator" register to be used is expressed solely by operand size; there's no "class" specifier there. Hence operand_size_match() is too eager in invoking match_{operand,simd}_size(), resulting in "operand size mismatch" errors when it's the type (of register), not the size that's wrong. Interestingly adjustments there alone lead to no error at all then: To "compensate", operand_type_match() needs to disambiguate register types when register instances are specified in the template (matching the actual operand), by checking a match (overlap) in operand sizes.
2025-05-16x86: fold Accum checking in operand_size_match()Jan Beulich1-16/+13
There's little point invoking match_{operand,simd}_size() twice per loop; in fact the SIMD case with D set simply doesn't exist. Amend the checks by one looking at the given operand, just like we already have been doing for memory ones.
2025-05-16x86: improve matching diagnosticsJan Beulich6-7/+31
Many times in the past I was puzzled by seeing "operand size mismatch" when really "operand type mismatch" would be far more appropriate. As it turns out, there were at least two flaws: In the single operand case we didn't propagate i.error to match_template()'s local specific_error when noticing a type mismatch. And then operand_size_match() was too eager in invoking match_mem_size(): Especially the Unspecified attribute can get in the way there when the expected operand isn't a memory one (and hence Unspecified would not be set in the operand template, whereas it's uniformly set for memory operands in AT&T syntax). (In the x86-64-lkgs-inval testcase the particular error for the two bogus Intel syntax forms doesn't really matter; all we ought to care about there isthat there is _some_ error.)
2025-05-16x86: drop bogus accumulator checkJan Beulich1-1/+0
Accum is an "instance", not a "class". With present enumerator values of Reg and Accum, the 2nd check simply did the same as the first. In fact checking for the accumulator (%rax) isn't necessary here at all, because there's no case where an individual template would permit alternatively a memory operand or the (qword) accumulator; only "any GPR" is ever being paired with "memory".
2025-05-16RISC-V: check offsets when linker relaxation is disabledTsukasa OI12-6/+214
The assembler partially relied on the linker to check whether the offset is valid. However, some optimization logic (added later) removes relocations relative to local symbols without checking offsets. For instance, it caused following code to silently emit wrong jumps (to the jump instruction "." itself) without relocations: > .option norelax > j .+0x200000 # J (or JAL) instruction cannot encode this offset. > j .+1 # Jump to odd address is not valid. This commit adds offset checks where necessary. gas/ChangeLog: * config/tc-riscv.c (md_apply_fix): Check offsets when the relocation relative to a local symbol is being optimized out. * testsuite/gas/riscv/no-relax-branch-offset-fail.s: Failure case where the branch offset is invalid. * testsuite/gas/riscv/no-relax-branch-offset-fail.d: Ditto. * testsuite/gas/riscv/no-relax-branch-offset-fail.l: Ditto. * testsuite/gas/riscv/no-relax-branch-offset-ok.s: Border case. * testsuite/gas/riscv/no-relax-branch-offset-ok.d: Ditto. * testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.s: Failure case only on RV64 where the PC-relative offset exceed limits. * testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.d: Ditto. * testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.l: Ditto. * testsuite/gas/riscv/no-relax-pcrel-offset-fail-not-32.d: Test case for RV32 so that no errors occur. * testsuite/gas/riscv/no-relax-pcrel-offset-ok.s: Border case. * testsuite/gas/riscv/no-relax-pcrel-offset-ok.d: Ditto.
2025-05-16RISC-V: Add zilsd & zclsd supportdysun12-1/+215
Ref: https://github.com/riscv/riscv-zilsd/blob/main/zilsd.adoc Signed-off-by: dysun <sundongya@nucleisys.com> Co-developed-by: LIU Xu <liuxu@nucleisys.com> Co-developed-by: ZHAO Fujin <zhaofujin@nucleisys.com>
2025-05-16Automatic date update in version.inGDB Administrator1-1/+1
2025-05-15gas: sframe: avoid creating more symbols than necessary for FRE offsetIndu Bhagat1-10/+10
Each SFrame FDE contains an offset to the start of its respective SFrame FREs in the sfde_func_start_fre_off field. To generate this offset, fre_symbols[] array is being used. The number of elements of this array is currently set to the total number of SFrame FREs in the entire SFrame section. This is more than unnecessary. We only need to track as many points as the number of SFrame FDEs. gas/ * gen-sframe.c (output_sframe_internal): Size fde_fre_symbols with the number of SFrame FDEs.
2025-05-15Fix regression with dynamic array boundsTom Tromey6-81/+154
Kévin discovered that commit ba005d32b0f ("Handle dynamic field properties") regressed a test in the internal AdaCore test suite. The problem here is that, when writing that patch, I did not consider the case where an array type's bounds might come from a member of a structure -- but where the array is not defined in the structure's scope. In this scenario the field-resolution logic would trip this condition: /* Defensive programming in case we see unusual DWARF. */ if (fi == nullptr) return nullptr; This patch reworks this area, partly backing out that commit, and fixes the problem. In the new code, I chose to simply duplicate the field's location information. This isn't totally ideal, in that it might result in multiple copies of a baton. However, this seemed nicer than tracking the DIE/field correspondence for every field in every CU -- my thinking here is that this particular dynamic scenario is relatively rare overall. Also, if the baton cost does prove onerous, we could intern the batons somewhere. Regression tested on x86-64 Fedora 41. I also tested this using the AdaCore internal test suite. Tested-By: Simon Marchi <simon.marchi@efficios.com>
2025-05-15ld: rename ldirname to stat_ldirnameAndreas Schwab1-2/+2
It conflicts with the ldirname function that will be added in the next libiberty sync. ld/: * ldlang.c (stat_ldirname): Rename from ldirname, all uses changed.
2025-05-15gdb: rename ldirname to gdb_ldirnameAndreas Schwab10-13/+13
It conflicts with the ldirname function that will be added in the next libiberty sync.
2025-05-15binutils: Don't complain plugin with all LTO sections removedH.J. Lu6-10/+45
When all LTO sections have been removed, the BFD lto_type is set to lto_non_ir_object by bfd_set_lto_type. In this case, don't complain needing a plugin when seeing a LTO slim symbol. bfd/ PR binutils/32967 * archive.c (_bfd_compute_and_write_armap): Call bfd_lto_slim_symbol_p to check LTO slim symbol. * bfd-in2.h: Generated. * bfd.c (bfd_lto_slim_symbol_p): New. binutils/ PR binutils/32967 * nm.c (filter_symbols): Call bfd_lto_slim_symbol_p to check LTO slim symbol. ld/ PR binutils/32967 * testsuite/ld-plugin/lto-binutils.exp: Run PR binutils/32967 tests. * testsuite/ld-plugin/strip-1a-s-all.nd: New file. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-05-15Automatic date update in version.inGDB Administrator1-1/+1
2025-05-15gas .file 0 vs. dwarf5Alan Modra1-3/+2
Support added in commit 3417bfca676f for dwarf5 directory table 0 assumed that .file 0 was always the first debug .file directive. That's not necessarily true. * dwarf2dbg.c (get_directory_table_entry): Don't assume entry 1 is available after putting DW_AT_comp_dir in entry 0. Pass pwd as file0_dirname to recursive call to avoid another getpwd in the case file0_dirname is NULL.
2025-05-14testsuite: fix gdb_exit for MinGW targetRohr, Stephan1-1/+2
GDB is not properly exited via 'remote_close host' when running the testsuite in a MinGW environment. Use the 'quit' command to properly exit the GDB debugging session. Approved-By: Tom Tromey <tom@tromey.com>
2025-05-14testsuite: get windows PID on MinGW targetRohr, Stephan1-1/+1
Also translate the MinGW PID to the Windows PID when running on a MinGW target. Approved-By: Tom Tromey <tom@tromey.com>
2025-05-14Fix create_breakpoint_parse_arg_string self-testTom Tromey1-8/+5
The emoji patch broke the create_breakpoint_parse_arg_string self-test when gdb is running on a suitable terminal. The problem is that the test case doesn't take the error prefix string into account. This patch fixes the test by having it compare the exception message directly, rather than relying on the result of exception_print. I did try a different approach, of having the test mimic exception_print, but this one seemed cleaner to me. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-05-14Add initializers to field_of_this_resultTom Tromey3-14/+3
This adds initializers to field_of_this_result, so that certain spots don't have to memset it. This approach seems safer and cleaner. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-05-14Fix some pre-commit nits in gdb/__init__.pyTom Tromey1-3/+3
I noticed that pre-commit has some complaints (flake8 and codespell) about gdb/__init__.py. This patch fixes these. Approved-By: Tom de Vries <tdevries@suse.de>
2025-05-14resbin: don't pass NULL as printf %s argAlan Modra1-5/+5
Fix three place where a NULL could be passed to "toosmall".
2025-05-14gas .file sanity checkAlan Modra1-19/+11
Currently we allow insane file numbers that cause gas to allocate up to 4G of memory for a file array. Trim that a little to 1G (which still allows insane file numbers up to 33554431), and tidy function parameter types so that we only need one file number sanity check. * dwarf2dbg.c (assign_file_to_slot): Take a valueT file number. Reduce max files array size. (allocate_filename_to_slot): Take a valueT file number. (dwarf2_directive_filename): Don't duplicate file number sanity check here.
2025-05-14Remove Marcus Shawcroft from the MAINTAINERS fileRichard Earnshaw1-1/+0
Marcus has resigned from the project.
2025-05-14ld/testsuite: Use $plug_opt for --plugin optionH.J. Lu2-9/+6
Use $plug_opt for --plugin usage, instead of running: run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so" PR binutils/21479 * testsuite/ld-plugin/lto-binutils.exp (lto_plugin): Removed. Replace "--plugin $lto_plugin" with $plug_opt. * testsuite/ld-plugin/lto.exp (lto_plugin): Removed. Replace "--plugin $lto_plugin" with $plug_opt. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-05-14Remove annoying spaces from objcopy.expMatthieu Longo1-4/+4
2025-05-14Remove annoying spaces from bfd/elfxx-aarch64.cMatthieu Longo1-1/+1
2025-05-14Remove annoying space from gas/config/obj-elf.cMatthieu Longo1-1/+1
2025-05-14strip: Add GCC LTO IR supportH.J. Lu10-25/+481
Add GCC LTO IR support to strip by copying GCC LTO IR input as unknown object file. Don't enable LTO plugin in strip unless all LTO sections should be removed, assuming all LTO sections will be removed with -R .gnu.lto_.*. Add linker LTO tests for strip with --strip-unneeded and GCC LTO IR inputs. binutils/ PR binutils/21479 * objcopy.c: Include "plugin-api.h" and "plugin.h". (lto_sections_removed): New. (command_line_switch): Add OPTION_PLUGIN. (strip_options): Likewise. (strip_usage): Display "--plugin NAME". (copy_unknown_file): New function. (copy_unknown_object): Call copy_unknown_file. (copy_archive): Copy input LTO IR member as unknown object. (copy_file): Set input target to "plugin" for strip if it is unset unless all LTO sections should be removed. Copy input LTO IR file as unknown file. (strip_main): Call bfd_plugin_set_program_name. Handle OPTION_PLUGIN. Set lto_sections_removed to true if all GCC LTO sections should be removed. * doc/binutils.texi: Document --plugin for strip. ld/ PR binutils/21479 * testsuite/ld-plugin/lto-binutils.exp: New file. * testsuite/ld-plugin/strip-1a-fat.c: Likewise. * testsuite/ld-plugin/strip-1a-fat.rd: Likewise. * testsuite/ld-plugin/strip-1b-fat.c: Likewise. * testsuite/ld-plugin/strip-1b-fat.rd: Likewise. * testsuite/ld-plugin/strip-1a.c: Likewise. * testsuite/ld-plugin/strip-1b.c: Likewise. * testsuite/lib/ld-lib.exp (run_cc_link_tests): Add optional trailing ld options. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-05-14ld: fix C23 issue in vers7 testSam James1-2/+2
This test is UNSUPPORTED on arm64 with GCC 15 (which defaults to -std=gnu23) because it now prototypes "no arguments". PR ld/32546 * ld-elfvers/vers7.c: Fix function definitions for C23.
2025-05-14Automatic date update in version.inGDB Administrator1-1/+1
2025-05-13aarch64: Replace incorrect commentAlice Carlotti1-7/+7
The comment explaining the placement of the cfinv entry before the generic msr entry in the opcode table was incorrect. The issue is unrelated to the all ones bitmask for cfinv, and is actually due the large number of architectural aliases of the msr instruction.
2025-05-13gdb/python: new gdb.ParameterPrefix classAndrew Burgess4-0/+502
This commit adds a new gdb.ParameterPrefix class to GDB's Python API. When creating multiple gdb.Parameters, it is often desirable to group these together under a sub-command, for example, 'set print' has lots of parameters nested under it, like 'set print address', and 'set print symbol'. In the Python API the 'print' part of these commands are called prefix commands, and are created using gdb.Command objects. However, as parameters are set via the 'set ....' command list, and shown through the 'show ....' command list, creating a prefix for a parameter usually requires two prefix commands to be created, one for the 'set' command, and one for the 'show' command. This often leads to some duplication, or at the very least, each user will end up creating their own helper class to simplify creation of the two prefix commands. This commit adds a new gdb.ParameterPrefix class. Creating a single instance of this class will create both the 'set' and 'show' prefix commands, which can then be used while creating the gdb.Parameter. Here is an example of it in use: gdb.ParameterPrefix('my-prefix', gdb.COMMAND_NONE) This adds 'set my-prefix' and 'show my-prefix', both of which are prefix commands. The user can then add gdb.Parameter objects under these prefixes. The gdb.ParameterPrefix initialise method also supports documentation strings, so we can write: gdb.ParameterPrefix('my-prefix', gdb.COMMAND_NONE, "Configuration setting relating to my special extension.") which will set the documentation string for the prefix command. Also, it is possible to support prefix commands that use the `invoke` functionality to handle unknown sub-commands. This is done by sub-classing gdb.ParameterPrefix and overriding either 'invoke_set' or 'invoke_show' to handle the 'set' or 'show' prefix command respectively. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2025-05-13gdb/guile: generate general description string for parametersAndrew Burgess4-18/+71
This commit builds on the previous one, and auto-generates a general description string for parameters defined via the Guile API. This brings the Guile API closer inline with the Python API. It is worth reading the previous commit to see some motivating examples. This commit updates get_doc_string in guile/scm-param.c to allow for the generation of a general description string. Then in gdbscm_make_parameter, if '#:doc' was not given, get_doc_string is used to generate a suitable default. This does invalidate (and so the commit removes) this comment that was in gdbscm_make_parameter: /* If doc is NULL, leave it NULL. See add_setshow_cmd_full. */ First, Python already does exactly what I'm proposing here, and has done for a while, with no issues reported. And second, I've gone and read add_setshow_cmd_full, and some of the functions it calls, and can see no reasoning behind this comment... ... well, there is one reason that I can think of, but I'll discuss that more below. With this commit, if I define a parameter like this: (use-modules (gdb)) (register-parameter! (make-parameter "print test" #:command-class COMMAND_NONE #:parameter-type PARAM_BOOLEAN)) Then, in GDB, I now see this behaviour: (gdb) help show print test Show the current value of 'print test'. This command is not documented. (gdb) help set print test Set the current value of 'print test'. This command is not documented. (gdb) The two 'This command is not documented.' lines are new. This output is what we get from a similarly defined parameter using the Python API (see the previous commit for an example). I mentioned above that I can think of one reason for the (now deleted) comment in gdbscm_make_parameter about leaving the doc field as NULL, and that is this: consider the following GDB behaviour: (gdb) help show style filename foreground Show the foreground color for this property. (gdb) Notice there is only a single line of output. If I want to get the same behaviour from a parameter defined in Guile, I might try skipping the #:doc argument, but (after this commit), if I do that, GDB will auto-generate some text for me, giving two lines of output (see above). So, next, maybe I try setting #:doc to the empty string, but if I do that, then I get this: (use-modules (gdb)) (register-parameter! (make-parameter "print test" #:doc "" #:command-class COMMAND_NONE #:parameter-type PARAM_BOOLEAN)) (gdb) help show print test Show the current value of 'print test'. (gdb) Notice the blank line, that's not what I wanted. In fact, the only way to get rid of the second line is to leave the 'doc' variable as NULL in gdbscm_make_parameter, which, due to the new auto-generation, is no longer possible. This issue also existed in the Python API, and was addressed in commit: commit 4b68d4ac98aec7cb73a4b276ac7dd38d112786b4 Date: Fri Apr 11 23:45:51 2025 +0100 gdb/python: allow empty gdb.Parameter.__doc__ string After this commit, an empty __doc__ string for a gdb.Parameter is translated into a NULL pointer passed to the add_setshow_* command, which means the second line of output is completely skipped. And this commit includes the same solution for the Guile API. Now, with this commit, and the Guile parameter using an empty '#:doc' string, GDB has the following behaviour: (gdb) help show print test Show the current value of 'print test'. (gdb) This matches the output for a similarly defined parameter in Python.
2025-05-13gdb/guile: improve auto-generated strings for parametersAndrew Burgess2-14/+40
Consider this user defined parameter created in Python: class test_param(gdb.Parameter): def __init__(self, name): super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN) self.value = True test_param('print test') If this is loaded into GDB, then we observe the following behaviour: (gdb) show print test The current value of 'print test' is "on". (gdb) help show print test Show the current value of 'print test'. This command is not documented. (gdb) help set print test Set the current value of 'print test'. This command is not documented. (gdb) If we now define the same parameter using Guile: (use-modules (gdb)) (register-parameter! (make-parameter "print test" #:command-class COMMAND_NONE #:parameter-type PARAM_BOOLEAN)) And load this into a fresh GDB session, we see the following: (gdb) show print test Command is not documented is off. (gdb) help show print test This command is not documented. (gdb) help set print test This command is not documented. (gdb) The output of 'show print test' doesn't make much sense, and is certainly worse than the Python equivalent. For both the 'help' commands it appears as if the first line is missing, but what is actually happening is that the first line has become 'This command is not documented.', and the second line is then missing. The problems can all be traced back to 'get_doc_string' in guile/scm-param.c. This is the guile version of this function. There is a similar function in python/py-param.c, however, the Python version returns one of three different strings depending on the use case. In contrast, the Guile version just returns 'This command is not documented.' in all cases. The three cases that the Python code handles are, the 'set' string, the 'show' string, and the general 'description' string. Right now the Guile get_doc_string only returns the general 'description' string, which is funny, because, in gdbscm_make_parameter, where get_doc_string is used, the one case that we currently don't need is the general 'description' string. Instead, right now, the general 'description' string is used for both the 'set' and 'show' cases. In this commit I plan to bring the Guile API a little more inline with the Python API. I will update get_doc_string (in scm-param.c) to return either a 'set' or 'show' string, and gdbscm_make_parameter will make use of these strings. The changes to the Guile get_doc_string are modelled on the Python version of this function. It is also worth checking out the next commit, which is related, and helps motivate how the changes have been implemented in this commit. After this commit, the same Guile parameter description shown above, now gives this behaviour: (gdb) show print test The current value of 'print test' is off. (gdb) help show print test Show the current value of 'print test'. (gdb) help set print test Set the current value of 'print test'. (gdb) The 'show print test' output now matches the Python behaviour, and is much more descriptive. The set and show 'help' output are now missing the second line when compared to the Python output, but the first line is now correct, and I think this is better than the previous Guile output. In the next commit I'll address the problem of the missing second line. Existing tests have been updated to expect the new output.
2025-05-13gdb/python: allow empty gdb.Parameter.__doc__ stringAndrew Burgess4-2/+111
I was recently attempting to create some parameters via the Python API. I wanted these parameters to appear similar to how GDB handles the existing 'style' parameters. Specifically, I was interested in this behaviour: (gdb) help show style filename foreground Show the foreground color for this property. (gdb) help set style filename foreground Set the foreground color for this property. (gdb) Notice how each 'help' command only gets a single line of output. I tried to reproduce this behaviour via the Python API and was unable. The problem is that, in order to get just a single line of output like this, the style parameters are registered with a call to add_setshow_color_cmd with the 'help_doc' being passed as nullptr. On the Python side, when parameters are created, the 'help_doc' is obtained with a call to get_doc_string (python/py-param.c). This function either returns the __doc__ string, or a default string: "This command is not documented.". To avoid returning the default we could try setting __doc__ to an empty string, but setting this field to any string means that GDB prints a line for that string, like this: class test_param(gdb.Parameter): __doc__ = "" def __init__(self, name): super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN) self.value = True test_param('print test') Then in GDB: (gdb) help set print test Set the current value of 'print test'. (gdb) The blank line is the problem I'd like to solve. This commit makes a couple of changes to how parameter doc strings are handled. If the doc string is set to an empty string, then GDB now converts this to nullptr, which removes the blank line problem, the new behaviour in GDB (for the above `test_param`) is: (gdb) help set print test Set the current value of 'print test'. (gdb) Next, I noticed that if the set/show docs are set to empty strings, then the results are less than ideal: class test_param(gdb.Parameter): set_doc = "" def __init__(self, name): super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN) self.value = True test_param('print test') And in GDB: (gdb) help set print test This command is not documented. (gdb) So, if the set/show docs are the empty string, GDB now forces these to be the default string instead, the new behaviour in GDB is: (gdb) help set print test Set the current value of 'print test'. This command is not documented. (gdb) I've added some additional asserts; the set/show docs should always be non-empty strings, which I believe is the case after this commit. And the 'doc' string returned from get_doc_string should never nullptr, but could be empty. There are new tests to cover all these changes.
2025-05-13gdb/python/guile: check for invalid prefixes in Command/Parameter creationAndrew Burgess6-2/+171
The manual for gdb.Parameter says: If NAME consists of multiple words, and no prefix parameter group can be found, an exception is raised. This makes sense; we cannot create a parameter within a prefix group, if the prefix doesn't exist. And this almost works, so: (gdb) python gdb.Parameter("xxx foo", gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN) Python Exception <class 'RuntimeError'>: Could not find command prefix xxx. Error occurred in Python: Could not find command prefix xxx. The prefix 'xxx' doesn't exist, and we get an error. But, if we try multiple levels of prefix: (gdb) python gdb.Parameter("print xxx foo", gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN) This completes without error, however, we didn't get what we were maybe expecting: (gdb) show print xxx foo Undefined show print command: "xxx foo". Try "help show print". But we did get: (gdb) show print foo The current value of 'print foo' is "off". GDB stopped scanning the prefix string at the unknown 'xxx', and just created the parameter there. I don't think this makes sense, nor is it inline with the manual. An identical problem exists with gdb.Command creation; GDB stops parsing the prefix at the first unknown prefix, and just creates the command there. The manual for gdb.Command says: NAME is the name of the command. If NAME consists of multiple words, then the initial words are looked for as prefix commands. In this case, if one of the prefix commands does not exist, an exception is raised. So again, the correct action is, I believe, to raise an exception. The problem is in gdbpy_parse_command_name (python/py-cmd.c), GDB calls lookup_cmd_1 to look through the prefix string and return the last prefix group. If the very first prefix word is invalid then lookup_cmd_1 returns NULL, and this case is handled. However, if there is a valid prefix, followed by an invalid prefix, then lookup_cmd_1 will return a pointer to the last valid prefix list, and will update the input argument to point to the start of the invalid prefix word. This final case, where the input is left pointing to an unknown prefix, was previously not handled. I've fixed gdbpy_parse_command_name, and added tests for command and parameter creation to cover this case. The exact same error is present in the guile API too. The guile documentation for make-parameter and make-command says the same things about unknown prefixes resulting in an exception, but the same error is present in gdbscm_parse_command_name (guile/scm-cmd.c), so I've fixed that too, and added some tests.
2025-05-13Automatic date update in version.inGDB Administrator1-1/+1
2025-05-12gdb/dwarf: skip broken .debug_macro.dwoSimon Marchi1-1/+19
Running gdb.base/errno.exp with gcc <= 13 with split DWARF results in: $ make check TESTS="gdb.base/errno.exp" RUNTESTFLAGS="CC_FOR_TARGET=gcc-13 --target_board=fission" (gdb) break -qualified main /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:7549: internal-error: locate_dwo_sections: Assertion `!dw_sect->readin' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ... FAIL: gdb.base/errno.exp: macros: gdb_breakpoint: set breakpoint at main (GDB internal error) The assert being hit has been added in 28f15782adab ("gdb/dwarf: read multiple .debug_info.dwo sections"), but it merely exposed an existing problem. gcc versions <= 13 are affected by this bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111409 Basically, it produces .dwo files with multiple .debug_macro.dwo sections, with some unresolved links between them. I think that this macro debug info is unusable, and all we can do is ignore it. In locate_dwo_sections, if we detect a second .debug_macro.dwo section, forget about the previous .debug_macro.dwo and any subsequent one. This will effectively make it as if the macro debug info wasn't there at all. The errno test seems happy with it: # of expected passes 84 # of expected failures 8 Change-Id: I6489b4713954669bf69f6e91865063ddcd1ac2c8 Approved-By: Tom Tromey <tom@tromey.com>
2025-05-12gdb/dwarf: move loops into locate_dw{o,z}_sectionsSimon Marchi3-69/+69
For a subsequent patch, it would be easier if the loop over sections inside locate_dwo_sections (I want to maintain some state for the duration of the loop). Move the for loop in there. And because locate_dwz_sections is very similar, modify that one too, to keep both in sync. Change-Id: I90b3d44184910cc2d86af265bb4b41828a5d2c2e Approved-By: Tom Tromey <tom@tromey.com>
2025-05-12gdb/dap: fix decode_sourceoltolm1-3/+3
The documentation for the Source interface says * The path of the source to be shown in the UI. * It is only used to locate and load the content of the source if no * `sourceReference` is specified (or its value is 0). but the code used `path` first. I fixed it to use `sourceReference` first. Approved-By: Tom Tromey <tom@tromey.com>
2025-05-12[PATCH] Add syscall tests when following/detaching from forkKeith Seitz2-0/+177
breakpoints/13457 discusses issues with syscall catchpoints when following forks, lamenting that there is no coverage for the various permutations of `follow-fork-mode' and `detach-on-fork'. This is an attempt to try and cover some of this ground. Unfortunately the state of syscall support when detaching after the fork is very, very inconsistent across various architectures. [I've tested extensively Fedora/RHEL platforms.] Right now, the only reliable platform to run tests on is x86_64/i?86 for the specific case where we do not detach from the fork. Consequently, this patch limits testing to those architectures. I have updated breakpoints/13457 with my findings on failures with the detaching case. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=13457 Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-05-12aarch64: Support for FEAT_RME_GPC3Ezra Sitorus3-0/+19
FEAT_RME_GPC3 - RME Granule Protection Check 3 Extension - introduces a method for defining a set of windows in the memory map for which Granule Protection Checks are skipped, and instead applies a set of default settings associated with the window. This patch introduces the sysreg gpcbw_el3. Add -march=armv9.5-a to access this sysreg since this feature is optional from armv9.5-a.