aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2022-01-07gdb/doc: shorten some source lines, and prevent some line breaksAndrew Burgess1-13/+17
Building on the previous commit, this makes use of a trailing @ to split long @deffn lines in the guile.texi source file. This splitting doesn't change how the document is laid out by texinfo. I have also wrapped keyword and argument name pairs in @w{...} to prevent line breaks appearing between the two. I've currently only done this for the longer @deffn lines, where a line break is possible. This makes the @deffn lines much nicer to read in the generated pdf.
2022-01-07gdb/doc: Remove (...) around guile procedure names in @deffn linesAndrew Burgess1-4/+11
Most guile procedures in the guile.texi file are defined like: @deffn {Scheme Procedure} name arg1 arg2 arg3 But there are two places where we do this: @deffn {Scheme Procedure} (name arg1 arg2 arg3) Notice the added (...). Though this does represent how a procedure call is written in scheme, it's not the normal style throughout the manual. I also checked the 'info guile' info page to see how they wrote there declarations, and they use the first style too. The second style also has the drawback that index entries are added as '(name', and so they are grouped in the '(' section of the index, which is not very user friendly. In this commit I've changed the definitions of make-command and make-parameter to use the first style. The procedure declaration lines can get pretty long with all of the arguments, and this was true for both of the procedures I am changing in this commit. I have made use of a trailing '@' to split the deffn lines, and keep them under 80 characters in the texi source. This makes no difference to how the final document looks. Finally, our current style for keyword arguments, appears to be: [#:keyword-name argument-name] I don't really understand the reason for this, 'info guile' just seems to use: [#:keyword-name] which seems just as good to me. But I don't propose to change that just now. What I do notice though, is that sometimes, texinfo will place a line break between the keyword-name and the argument-name, for example, the pdf of make-command is: make-command name [#:invoke invoke] [#:command-class command-class] [#:completer-class completer] [#:prefix? prefix] [#:doc doc-string] Notice the line break after '#:command-class' and after '#:doc', neither of which are ideal. And so, for the two commands I am changing in this commit, I have made use of @w{...} to prevent line breaks between the keyword-name and the argument-name. Now the pdf looks like this: make-command name [#:invoke invoke] [#:command-class command-class] [#:completer-class completer] [#:prefix? prefix] [#:doc doc-string] Which seems much better. I'll probably update the other deffn lines at some point.
2022-01-06Use target_announce_detach in more targetsTom Tromey4-37/+11
target_announce_detach was added in commit 0f48b757 ("Factor out "Detaching from program" message printing"). There, Pedro wrote: (For now, I left the couple targets that print this a bit differently alone. Maybe this could be further pulled out into infcmd.c. If we did that, and those targets want to continue printing differently, this new function could be converted to a target method.) It seems to me that the differences aren't very big, and in some cases other targets handled the output a bit more nicely. In particular, some targets will print a different message when exec_file==NULL, rather than printing the same output with an empty string as exec_file. This patch incorporates the nicer output into target_announce_detach, then changes the remaining ports to use this function.
2022-01-06Introduce target_announce_attachTom Tromey9-77/+30
This introduces target_announce_attach, by analog with target_announce_detach. Then it converts existing targets to use this, rather than emitting their own output by hand.
2022-01-06gdb: make use add_setshow_prefix_cmd in gnu-nat.cAndrew Burgess1-46/+13
In gnu-nat.c we currently implement some set/show prefix commands "manually", that is, we call add_prefix_cmd, and assign a set and show function to each prefix command. These set/show functions print an error indicating that the user didn't type a complete command. If we instead switch to using add_setshow_prefix_cmd then we can delete the set/show functions, GDB provides some default functions, which give a nice help style summary that lists all of the available sub-commands, along with a one line summary of what each does. Though this clearly changes the existing behaviour, I think this change is acceptable as the new behaviour is more inline with other set/show prefix commands, and the new behaviour is more informative. This change will conflict with Tom's change here: https://sourceware.org/pipermail/gdb-patches/2022-January/184724.html Where Tom changes the set/show functions that I delete. My suggestion is that the set/show functions still be deleted even after Tom's patch (or instead of Tom's patch). For testing I've build GDB on GNU/Hurd, and manually tested these functions. I did a grep over the testsuite, and don't believe the existing error messages are being checked for in any tests.
2022-01-06Use warning in windows-nat error messagesTom Tromey1-5/+2
A warning in windows-nat.c can be converted to use the warning function. As a side effect, this arranges for the output to be sent to gdb_stderr.
2022-01-06Clean up some dead code in windows-tdep.cTom Tromey1-24/+20
windows-tdep.c checks the result of xmalloc, which isn't necessary. I initially removed this dead check, but then went a bit further and modified the code so that some "goto"s and explicit memory management could be removed. Then, I added a couple of missing bounds checks. I believe this also fixes a possible bug with a missing 0-termination of a string. I am not certain, but that is why I think the existing code allocates a buffer that is 1 byte too long -- but then it fails to set this byte to 0.
2022-01-06Avoid crash in language_infoTom Tromey2-1/+10
language_info calls: show_language_command (NULL, 1, NULL, NULL); ... "knowing" that show_language_command does not use its ui_file parameter. However, this was changed in commit 7514a661 ("Consistently Use ui_file parameter to show callbacks"). This patch changes language_info to pass a ui_file. It took a while to write the test -- this function is only called when 'verbose' is on and when switching the "expected" language in auto mode.
2022-01-06Fix some failures in langs.expTom Tromey1-3/+3
langs.exp currently has some fails for me because the stack trace includes full paths to the source files. FAIL: gdb.base/langs.exp: up to foo in langs.exp FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp FAIL: gdb.base/langs.exp: up to fsub in langs.exp This fixes the failures by making the filename regexps a bit more lax.
2022-01-06gdb: Fix copyright year in gdb/testsuite/gdb.base/inferior-clone.expLancelot SIX1-1/+1
I just realized that I forgot to update the year before pushing the patch that created this file. Since it landed after the global copyright year update have been done, this file’s copyright year is updated. This patch fixes that. Change-Id: I280f7d86e02d38425f7afdcf19a1c3500d51c23f
2022-01-05Change riscv_return_value to use RETURN_VALUE_ABI_PRESERVES_ADDRESSTom Tromey1-1/+1
Internally, AdaCore has a test that is equivalent to (really a direct translation of) gdb.base/gnu_vector.exp. On 32-bit RISC-V, the "return" part of this test fails. Joel tracked this down to riscv_return_value returning RETURN_VALUE_ABI_RETURNS_ADDRESS. Using RETURN_VALUE_ABI_PRESERVES_ADDRESS is more correct here, and fixes the bug. I tested this for both 32- and 64-bit RISC-V using the AdaCore internal test suite, and Andrew Burgess tested it using gnu_vector.exp.
2022-01-05Filtered output cleanup in expression dumpingTom Tromey1-13/+13
Most of the expression-dumping code uses filtered output, but a few functions did not. This patch cleans up these instance. Note that this won't cause any behavior change, because the only calls to dump_prefix_expression pass in gdb_stdlog. However, in the long run it's easier to audit the code if the number of uses of _unfiltered is reduced.
2022-01-05Use filtered output in terminal_info implementationsTom Tromey2-8/+8
This changes one terminal_info implementation, and default_terminal_info, to use filtered output. Other implementations of this method already use filtered output. I can't compile go32-nat.c, so this is a 'best effort' patch.
2022-01-05Use filtered output in gnu-nat.c commandsTom Tromey1-49/+53
gnu-nat.c has a number of ordinary commands that should use filtered output. In a few cases, I changed the output to use gdb_stderr as well. I can't compile this file, so this patch is split out as a "best effort".
2022-01-05Use filtered output in *-tdep commandsTom Tromey5-23/+23
Various targets introduce their own commands, which then use unfiltered output. It's better to use filtered output by default, so this patch fixes the instances I found.
2022-01-05Use filtered output in btrace-related commandsTom Tromey2-86/+86
This changes btrace.c and record-btrace.c to use filtered output in the commands implemented there.
2022-01-05Use filtered output in some dumping commandsTom Tromey5-61/+61
There are several commands that may optionally send their output to a file -- they take an optional filename argument and open a file. This patch changes these commands to use filtered output. The rationale here is that, when printing to gdb_stdout, filtering is appropriate -- it is, and should be, the default for all commands. And, when writing to a file, paging will not happen anyway (it only happens when the stream==gdb_stdout), so using the _filtered form will not change anything.
2022-01-05Use filtered output in kill commandTom Tromey1-4/+3
This changes the kill command to use filtered output. I split this one into its own patch because, out of an abundance of caution, I changed the function to call bfd_cache_close_all a bit earlier, in case pagination caused an exception.
2022-01-05Use filtered output in ordinary commandsTom Tromey18-89/+89
Many otherwise ordinary commands choose to use unfiltered output rather than filtered. I don't think there's any reason for this, so this changes many such commands to use filtered output instead. Note that complete_command is not touched due to a comment there explaining why unfiltered output is believed to be used.
2022-01-05Use filtered output in language_infoTom Tromey1-1/+1
Change language_info to use filtered output. This is ok because the sole caller uses filtered output elsewhere, and because this function calls show_language_command, which also uses filtered output.
2022-01-05Use filtered output in files_info implementationsTom Tromey5-15/+15
This changes the implementations of the target files_info method to use filtered output. This makes sense because the sole caller of this method is an ordinary command (info_program_command). This patch changes this command to use filtered output as well.
2022-01-05Use filtered output in target-descriptions.cTom Tromey1-76/+76
target-descriptions.c uses unfiltered output. However, if you happen to invoke this command interactively, it's probably better for it to use filtering. For non-interactive use, this doesn't matter.
2022-01-05Use filtered output for gdbarch dumpTom Tromey10-357/+357
This changes gdbarch dumping to use filtered output. This seems a bit better to me, both on the principle that this is an ordinary command, and because the output can be voluminous, so it may be nice to stop in the middle.
2022-01-05Implement putstr and putstrn in ui_fileTom Tromey10-139/+158
In my tour of the ui_file subsystem, I found that fputstr and fputstrn can be simplified. The _filtered forms are never used (and IMO unlikely to ever be used) and so can be removed. And, the interface can be simplified by removing a callback function and moving the implementation directly to ui_file. A new self-test is included. Previously, I think nothing was testing this code. Regression tested on x86-64 Fedora 34.
2022-01-05Change how versioned symbols are recordedTom Tromey1-35/+34
A change to BFD caused a gdb regression when using the Ada "catch exception" feature. The bug is visible when a shared library throws an exception that is caught in the main executable. This was discussed here: https://sourceware.org/pipermail/binutils/2021-July/117538.html This patch implements Alan's proposed fix, namely to use VERSYM_HIDDEN rather than the name when deciding to install a version-less symbol. The internal test case is identical to the catch_ex_std.exp that is in-tree, so I haven't added a new test. I could not make that one fail on x86-64 Linux, though. It's possible that maybe I'd have to update the system linker first, but I didn't want to try that. Regression tested on x86-64 Fedora 32.
2022-01-05Fix inferior_thread attribute in new_thread eventHannes Domani2-2/+4
Commit 72ee03ff58 fixed a use-after-move bug in add_thread_object, but it changed the inferior_thread attribute to contain the inferior instead of the actual thread. This now uses the thread_obj in its new location instead. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28429
2022-01-05Simplify execute_control_commands_to_stringTom Tromey1-23/+7
execute_control_commands_to_string can be rewritten in terms of execute_fn_to_string, which consolidates some knowledge about which streams to redirect. Regression tested on x86-64 Fedora 34.
2022-01-05Do not print anything when self-backtrace unavailableTom Tromey2-2/+11
Right now, gdb's self-backtrace feature will still print something when a backtrace is unavailable: sig_write (_("----- Backtrace -----\n")); [...] sig_write (_("Backtrace unavailable\n")); sig_write ("---------------------\n"); However, if GDB_PRINT_INTERNAL_BACKTRACE is undefined, it seems better to me to print nothing at all. This patch implements this change. It also makes a couple of other small changes in this same module: it adds a header guard to bt-utils.h, and it protects the definitions of gdb_internal_backtrace_1 with a check of GDB_PRINT_INTERNAL_BACKTRACE.
2022-01-05Fix pager regressionTom Tromey2-0/+11
The patch to fix paging with redirection caused a regression in the internal AdaCore test suite. The problem occurs when running an MI command from the CLI using interpreter-exec, when paging is enabled. This scenario isn't covered by the current test suite, so this patch includes a new test. The problem is that, in this situation, MI does: fputs_unfiltered (strcmp (context->command, "target-select") == 0 ? "^connected" : "^done", mi->raw_stdout); Here raw_stdout is a stdio_file wrapping stdout, so the pager thinks that it is ok to buffer the output. However, in this setup, it isn't ok, and flushing the wrap buffer doesn't really work properly. Also, MI next does: mi_out_put (uiout, mi->raw_stdout); ... but this uses ui_file::write, which also doesn't flush the wrap buffer. I think all this will be fixed by the pager rewrite series I'm working on. However, in the meantime, adding the old gdb_stdout check back to the pager fixes this problem. Regression tested on x86-64 Fedora 34.
2022-01-04gdb/testsuite: fix inferior-clone.exp for native-extended-gdbserverLancelot SIX1-2/+2
003aae076207dbf32f98ba846158fc32669ef85f (gdb: Copy inferior properties in clone-inferior) introduced a testcase that fails when testing with the native-extended-gdbserver board: Running ../gdb/testsuite/gdb.base/inferior-clone.exp ... FAIL: gdb.base/inferior-clone.exp: inferior 2: clone-inferior FAIL: gdb.base/inferior-clone.exp: inferior 3: clone-inferior The error is as follows: clone-inferior [New inferior 2] Added inferior 2 on connection 1 (extended-remote localhost:2346) (gdb) FAIL: gdb.base/inferior-clone.exp: inferior 2: clone-inferior This fails because the testcase only expect the 'Added inferior 2' part of the message. The 'on connection 1 [...]' part is unexpected. Fix by adjusting the testcase to a account for the possible trailing part of the message. Tested on x86_64-linux with native-extende-gdbserver and unix boards. Change-Id: Ie3d6f04c9ffe9cab1fbda8ddf4935ee09b858c7a
2022-01-04[gdb/build] Fix build breaker in gdb/cli/cli-logging.cTom de Vries1-2/+2
Fix build breaker in gdb/cli/cli-logging.c: ... gdb/cli/cli-logging.c: In function \ ‘void show_logging_enabled(ui_file*, int, cmd_list_element*, const char*)’: gdb/gdbsupport/gdb_locale.h:28:28: error: cannot convert ‘char*’ to ‘ui_file*’ 28 | # define _(String) gettext (String) | ~~~~~~~~^~~~~~~~ | | | char* gdb/cli/cli-logging.c:202:25: note: in expansion of macro ‘_’ 202 | fprintf_unfiltered (_("on: Logging is enabled.\n")); | ^ ... Build and tested on x86_64-linux. Fixes: 45aec4e5ed8 ("[gdb/cli] Improve show logging output")
2022-01-03[gdb/cli] Improve show logging outputTom de Vries1-8/+26
Before commit 3b6acaee895 "Update more calls to add_prefix_cmd" we had the following output for "show logging": ... $ gdb -q -batch -ex "set trace-commands on" \ -ex "set logging off" \ -ex "show logging" \ -ex "set logging on" \ -ex "show logging" +set logging off +show logging Future logs will be written to gdb.txt. Logs will be appended to the log file. Output will be logged and displayed. Debug output will be logged and displayed. +set logging on +show logging Currently logging to "gdb.txt". Logs will be appended to the log file. Output will be logged and displayed. Debug output will be logged and displayed. ... After that commit we have instead: ... +set logging off +show logging debugredirect: The logging output mode is off. file: The current logfile is "gdb.txt". overwrite: Whether logging overwrites or appends to the log file is off. redirect: The logging output mode is off. +set logging on +show logging debugredirect: The logging output mode is off. file: The current logfile is "gdb.txt". overwrite: Whether logging overwrites or appends to the log file is off. redirect: The logging output mode is off. ... which gives less clear output for some subcommands. OTOH, it's explicit about whether boolean values are on or off. The new text seems to have been chosen to match the set/show help texts: ... (gdb) help show logging Show logging options. List of show logging subcommands: show logging debugredirect -- Show the logging debug output mode. show logging file -- Show the current logfile. show logging overwrite -- \ Show whether logging overwrites or appends to the log file. show logging redirect -- Show the logging output mode. ... Make the show logging messages more clear, while still keep the boolean values explicit, such that we have: ... $ ./gdb.sh -q -batch -ex "show logging" logging debugredirect: off: \ Debug output will go to both the screen and the log file. logging enabled: off: Logging is disabled. logging file: The current logfile is "gdb.txt". logging overwrite: off: Logging appends to the log file. logging redirect: off: Output will go to both the screen and the log file. ... Tested on x86_64-linux.
2022-01-03Fix use of 'printf' in gdbtypes.cTom Tromey1-1/+1
An earlier patch of mine, commit 64b7cc50 ("Remove gdb_print_host_address") inadvertently changed a function in gdbtypes.c to use printf rather than printf_filtered. This patch fixes the problem.
2022-01-03Fix regression in page-logging.expTom Tromey1-2/+1
Simon and Tom pointed out that page-logging.exp failed on their machines. Tom tracked this down to the "width" setting. Since there's no need in the test to change the width, it seems simplest to remove the setting. I confirmed that the test still fails if the fix is backed out, ensuring that the test is still testing what it purports to.
2022-01-03Small indentation fix in eval.cTom Tromey1-1/+1
I noticed that the AdaCore tree had a small divergence in eval.c -- it had a fix for an indentation problem in binop_promote. I'm checking in this small fix as obvious.
2022-01-03[gdb/testsuite] Handle for loop initial decl with gcc 4.8.5Tom de Vries7-9/+19
When running test-case gdb.threads/schedlock-thread-exit.exp on a system with system compiler gcc 4.8.5, I run into: ... src/gdb/testsuite/gdb.threads/schedlock-thread-exit.c:33:3: error: \ 'for' loop initial declarations are only allowed in C99 mode ... Fix this by: - using -std=c99, or - using -std=gnu99, in case that's required, or - in the case of the jit test-cases, rewriting the for loops. Tested on x86_64-linux, both with gcc 4.8.5 and gcc 7.5.0.
2022-01-02Update copying.awk for _initialize declaration patchTom Tromey1-1/+2
Commit 6c265988 ("gdb: add back declarations for _initialize functions") modified copying.c, but not copying.awk. This patch updates copying.awk to backport the appropriate fix. This way, if copying.awk is run again, it will create the correct output. I'm checking this in as obvious.
2022-01-02Use filtered output in print_i387_extTom Tromey1-1/+1
print_i387_ext mostly uses filtered output, but one call in the middle of the function uses the _unfiltered form. This patch fixes this call. I'm checking this in as obvious.
2022-01-01gdb: copyright: fix a few comment typosMike Frysinger1-2/+2
2022-01-01gdb: update sim mips testsuite copyright exemptionMike Frysinger1-1/+1
The sim testsuite was reorganized last year, so update the path.
2022-01-01unify 64-bit bfd checksMike Frysinger4-85/+74
Move the 64-bit bfd logic out of bfd/configure.ac and into bfd64.m4 under config so it can be shared between all the other subdirs. This replaces want64 with enable_64_bit_bfd which was already being declared, but not used directly.
2022-01-01Update Copyright year in gdb/testsuite/gdb.arch/powerpc-power10.expJoel Brobecker1-1/+1
This commit updates the copyright year range in the script gdb/testsuite/gdb.arch/powerpc-power10.exp. The update was performed by running gdb/copyright.py again, to make sure that the copyright year range will be automatically updated in years forward.
2022-01-01Fix copyright header in gdb/testsuite/gdb.arch/powerpc-power10.expJoel Brobecker1-1/+1
The copyright year and holder line is slight malformed, missing a space after a comma, and this is sufficient for gdb's copyright.py script to miss this file during its automated copyright year update. This commit fixes this.
2022-01-01gdb/copyright.py: Add update-netbsd.sh to MULTIPLE_COPYRIGHT_HEADERSJoel Brobecker1-0/+1
Add gdb/syscalls/update-netbsd.sh to the reminder printed at the end of the execution listing all the files where a manual update of the copyright header is needed. This scripts contains some inline code which includes a copyright header.
2022-01-01Manual copyright year update of various GDB filesJoel Brobecker4-6/+6
This commit updates the copyright year in some files where we have a copyright year outside of the copyright year, and thus are not included in gdb's copyright.py script.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker5760-5760/+5760
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.
2022-01-01Update Copyright Year in gdb, gdbserver and gdbreplay version outputJoel Brobecker1-1/+1
This commit changes the copyright year printed by gdb, gdbserver and gdbreplay when printing the tool's version.
2021-12-31Do not call reinitialize_more_filter from avr_io_reg_read_commandTom Tromey1-2/+0
avr_io_reg_read_command is an ordinary gdb command, and so should not be calling reinitialize_more_filter. This patch removes it. I'm checking this in as obvious. Tested by rebuilding.
2021-12-29Use filtered output in show callbacksTom Tromey4-15/+15
"show" command callbacks, like most ordinary gdb commands, should use filtered output. I found a few that did not, so this patch changes them to use the filtered form.
2021-12-29Consistently Use ui_file parameter to show callbacksTom Tromey11-42/+46
I happened to notice that one "show" callback was printing to gdb_stdout rather than to the passed-in ui_file parameter. I went through all such callbacks and fixed them to consistently use the ui_file. Regression tested on x86-64 Fedora 34.