aboutsummaryrefslogtreecommitdiff
path: root/gdb/make-init-c
AgeCommit message (Collapse)AuthorFilesLines
8 daysChange file initialization to use INIT_GDB_FILE macroTom Tromey1-11/+14
This patch introduces a new macro, INIT_GDB_FILE. This is used to replace the current "_initialize_" idiom when introducing a per-file initialization function. That is, rather than write: void _initialize_something (); void _initialize_something () { ... } ... now you would write: INIT_GDB_FILE (something) { ... } The macro handles both the declaration and definition of the function. The point of this approach is that it makes it harder to accidentally cause an initializer to be omitted; see commit 2711e475 ("Ensure cooked_index_entry self-tests are run"). Specifically, the regexp now used by make-init-c seems harder to trick. New in v2: un-did some erroneous changes made by the script. The bulk of this patch was written by script. Regression tested on x86-64 Fedora 41.
2025-05-23[gdb] Make make-init-c more robustTom de Vries1-2/+2
In commit 2711e4754fc ("Ensure cooked_index_entry self-tests are run"), we rewrite the function definition of _initialize_dwarf2_entry into a normal form that allows the make-init-c script to detect it: ... void _initialize_dwarf2_entry (); -void _initialize_dwarf2_entry () +void +_initialize_dwarf2_entry () ... Update make-init-c to also detect the "void _initialize_dwarf2_entry ()" variant. Tested on x86_64-linux, by reverting commit 2711e4754fc, rebuilding and checking that build/gdb/init.c doesn't change.
2025-04-08Update copyright dates to include 2025Tom Tromey1-1/+1
This updates the copyright headers to include 2025. I did this by running gdb/copyright.py and then manually modifying a few files as noted by the script. Approved-By: Eli Zaretskii <eliz@gnu.org>
2024-03-26gdb, gdbserver, gdbsupport: remove includes of early headersSimon Marchi1-1/+0
Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-07-13Use /bin/sh as shebang in gdb/make-init-cLancelot SIX1-1/+1
While testing the NixOS[1] packaging for gdb-11.0.90.tar.xz, IĀ got the following error: [...] CXX aarch32-tdep.o CXX gdb.o GEN init.c /nix/store/26a78ync552m8j4sbjavhvkmnqir8c9y-bash-4.4-p23/bin/bash: ./make-init-c: /usr/bin/env: bad interpreter: No such file or directory make[2]: *** [Makefile:1866: stamp-init] Error 126 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/build/gdb-11.0.90/gdb' make[1]: *** [Makefile:9814: all-gdb] Error 2 make[1]: Leaving directory '/build/gdb-11.0.90' make: *** [Makefile:903: all] Error 2 builder for '/nix/store/xs8my3rrc3l4kdlbpx0azh6q0v0jxphr-gdb-gdb-11.0.90.drv' failed with exit code 2 error: build of '/nix/store/xs8my3rrc3l4kdlbpx0azh6q0v0jxphr-gdb-gdb-11.0.90.drv' failed In the nix build environment, /usr/bin/env is not present, only /bin/sh is. This patch makes sure that gdb/make-init-c uses '/bin/sh' as interpreter as this is the only one available on this platform. I do not think this change will cause regressions on any other configuration. [1] https://nixos.org/ gdb/Changelog * make-init-c: Use /bin/sh as shebang.
2021-05-27gdb: add option to reverse order of _initialize function callsSimon Marchi1-1/+14
An earlier patch in this series fixed a dependency problem between two _initialize functions. That problem was uncovered by reversing the order of the initialize function calls. In short, symtab.c tried to add the alias "maintenance flush-symbol-cache" for the command "maintenance flush symbol-cache". Because the "maintenance flush" prefix command was not yet created (it happens in maint.c, initialized later in this reversed order), the add_alias_cmd function returned NULL. That result was passed to deprecate_cmd, which didn't expected that value, and that caused a segfault. This was fixed by changing alias creation functions to take the target command as a cmd_list_element, instead of by name. This patch adds a runtime option to reverse the order of the initialize calls at will. I chose to use an environment variable for this, over a parameter (even a "maintenance" one), because: - The init functions are called before the early init commands are executed, so we could use -iex to turn this mode on early enough. This is obvious when you remember that commands / parameters are created by initialize funcitions :). - This is not something anybody would want to tweak after startup anyway. gdb/ChangeLog: * make-init-c: Add option to reverse function calls. gdb/testsuite/ChangeLog: * gdb.base/reverse-init-functions.exp: New. Change-Id: I543e609cf526e7cb145a006a794d0e6851b63f45
2021-05-27gdb: add make-init-c scriptSimon Marchi1-0/+57
I would like to modify how the init.c file is generated (its content). But as it is, a shell script with multiple sed invocations in a Makefile target, it's not very maintainable. Replace that with a shell script that does the same, but in a more readable way. The Makefile rule uses the "-" prefix in front of the for loop, I presume to ignore any error coming from the fact that xml-builtin.c and cp-name-parser.c are not found in the srcdir (they are generated source files). I prefer not to blindly ignore errors, so filter these files out of INIT_FILES instead (we already filter out other files). There are no expected meaningful changes to the generated init.c file. Just the _initialize_all_file declaration that is moved down and "void" in parenthesis that is removed. The new regular expression is a bit tighter than the existing one, it requires the init function to be followed by exactly ` ()`. Update bpf-tdep.c accordingly. gdb/ChangeLog: * Makefile.in (INIT_FILES_FILTER_OUT): New. (INIT_FILES): Use INIT_FILES_FILTER_OUT. (stamp-init): Use make-init-c. * bpf-tdep.c (_initialize_bpf_tdep): Remove "void". * silent-rules.mk (ECHO_INIT_C): Change. * make-init-c: New file. Change-Id: I6d6b12cbccf24ab79d1219bff05df01624c684f9