aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
AgeCommit message (Collapse)AuthorFilesLines
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.
2024-01-08Add deferred_warnings parameter to read_addrmap_from_arangesTom Tromey1-4/+12
When DWARF reading is done in the background, read_addrmap_from_aranges will be called from a worker thread. Because warnings can't be emitted from these threads, this patch adds a new deferred_warnings parameter to the function, letting the caller control exactly how the warnings are emitted.
2023-10-05gdb: remove print_sys_errmsgAndrew Burgess1-1/+7
This started with me running into this comment in symfile.c: /* FIXME, should use print_sys_errmsg but it's not filtered. */ gdb_printf (_("`%ps' has disappeared; keeping its symbols.\n"), styled_string (file_name_style.style (), filename)); In this particular case I think I disagree with the comment; I think the output should be a warning rather than just a message printed to gdb_stdout, I think when the executable, or some other objfile that is currently being debugged, disappears from disk, this is likely an unexpected situation, and worth warning the user about. So, in theory, I could just call print_sys_errmsg and remove the comment, but that would mean loosing the filename styling in the output... so in the end I remove the comment and updated the code to call warning. But that got me looking at print_sys_errmsg and how it's used. Currently the function takes a string and an errno, and prints, to stderr, the string followed by the result of calling strerror on the errno. In some places the string passed to print_sys_errmsg is just a filename, and this is used when something goes wrong. In these cases, I think calling warning rather than gdb_printf to gdb_stderr, would be better, and in fact, in a couple of places we manually print a "warning" prefix, and then call print_sys_errmsg. And so, for these users I have added a new function warning_filename_and_errno, which takes a filename, which is printed with styling, and an errno, which is passed through strerror and the resulting string printed. This new function calls warning to print its output. I then updated some of the print_sys_errmsg users to use this new function. Some other users of print_sys_errmsg are also emitting what is clearly a warning, however, the string being passed in is more than just a filename, so the new warning_filename_and_errno function can't be used, it would style the whole string. For these users I have switched to calling warning directly, this allows me to style the warning message correctly. Finally, in inflow.c there is one last call to print_sys_errmsg, in this case I just inlined the definition of print_sys_errmsg. This is a really weird case, as after printing this message GDB just does a hard exit. This is pretty old code, dating back to the initial GDB import, I guess it should be updated to call error() maybe, but I'm reluctant to make this change as part of this commit, just in case there's some reason why we can't throw an error at this point. With that done there are now no users of print_sys_errmsg, and so the old function can be removed. While I was doing all of the above I added some additional filename styling in soure.c, this is in an else block where the if contained the print_sys_errmsg call, so these felt related. And finally, while I was updating the uses of print_sys_errmsg in procfs.c, I noticed that we used a static errmsg buffer to format some error strings. As the above changes got rid of one of the users of errmsg I also removed the other two users, and the static buffer. There were a couple of tests that depended on the existing output message format that needed updating. In one case we gained an extra 'warning: ' prefix, and in the other 'Warning: ' becomes 'warning: ', I think in both cases the new output is an improvement. Approved-By: Tom Tromey <tom@tromey.com>
2023-07-15gdb: style filenames in separate debug file warningsAndrew Burgess1-0/+52
After the commit: commit 6647f05df023b63bbe056e9167e9e234172fa2ca Date: Tue Jan 24 18:13:38 2023 +0100 gdb: defer warnings when loading separate debug files It was pointed out[1] that the warnings being deferred and then later emitted lacked styling. The warnings lacked styling before the above commit, but it was suggested that the filenames in these warnings should be styled, and this commit does this. There were a couple of previous attempts[2][3][4] to solve this problem, but these all tried to extend the mechanism introduced in the above commit, the deferred warnings were placed directly into a std::vector, but now we tried to, when appropriate, style these warnings. The review feedback that this approach looked too complex. So instead, this revision adds a new helper class 'deferred_warnings' which can be used to collect a set of deferred warnings, and then emit these deferred warnings later, if needed. This helper class hides the complexity, so at the point the deferred warning is created no extra logic is required. The deferred_warnings class will style the deferred warnings only if gdb_stderr supports styling. GDB's warnings are sent to gdb_stderr, so this should ensure we only style when expected. There was also review feedback[5] that all of the warnings should be bundled into a single string_file, this has not been done. I feel pretty strongly that separate warnings should be emitted using separate "warning" calls. If we do end up with multiple warnings in this case they aren't really related, one will be about looking up debug via .gnu_debuglink, while the other will be about build-id based lookup. So I'd really rather keep the warnings separate. [1] https://inbox.sourceware.org/gdb-patches/87edr9pcku.fsf@tromey.com/ [2] https://inbox.sourceware.org/gdb-patches/20230216195604.2685177-1-ahajkova@redhat.com/ [3] https://inbox.sourceware.org/gdb-patches/20230217123547.2737612-1-ahajkova@redhat.com/ [4] https://inbox.sourceware.org/gdb-patches/20230320145638.1202335-1-ahajkova@redhat.com/ [5] https://inbox.sourceware.org/gdb-patches/87o7nh1g8h.fsf@tromey.com/ Co-Authored-By: Alexandra Hájková <ahajkova@redhat.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-07-14Revert "Simplify auto_load_expand_dir_vars and remove substitute_path_component"Tom Tromey1-0/+3
This reverts commit 02601231fdd91a7bd4837ce202906ea2ce661489. This commit was a refactoring to remove an xrealloc and simplify utils.[ch]. However, it has a flaw -- it mishandles a substitution like "$datadir/subdir". I am backing out the patch in the interests of fixing the regression before GDB 14. It can be reinstated (with modifications) later if we like. Regression tested on x86-64 Fedora 36.
2023-06-19[gdb] Add template functions assign_return/set_if_changedTom de Vries1-0/+27
Add template functions assign_return_if_changed and assign_set_if_changed in gdb/utils.h: ... template<typename T> void assign_set_if_changed (T &lval, const T &val, bool &changed) { ... } template<typename T> bool assign_return_if_changed (T &lval, const T &val) { ... } ... This allows us to rewrite code like this: ... if (tui_border_attrs != entry->value) { tui_border_attrs = entry->value; need_redraw = true; } ... into this: ... need_redraw |= assign_return_if_changed<int> (tui_border_attrs, entry->value); ... or: ... assign_set_if_changed<int> (tui_border_attrs, entry->value, need_redraw); ... The names are a composition of the functionality. The functions: - assign VAL to LVAL, and either - return true if the assignment changed LVAL, or - set CHANGED to true if the assignment changed LVAL. Tested on x86_64-linux.
2023-05-05Simplify auto_load_expand_dir_vars and remove substitute_path_componentTom Tromey1-3/+0
This simplifies auto_load_expand_dir_vars to first split the string, then do any needed substitutions. This was suggested by Simon, and is much simpler than the current approach. Then this patch also removes substitute_path_component, as it is no longer called. This is nice because it helps with the long term goal of removing utils.h. Regression tested on x86-64 Fedora 36.
2023-05-02Remove error_streamTom Tromey1-2/+0
error_stream is trivial and only used in a couple of spots in breakpoint.c. This patch removes it in favor of just writing it out at the spots where it was used.
2023-04-30[gdb/tui] Fix TUI resizing for TERM=ansiTom de Vries1-0/+7
With TERM=ansi, when resizing a TUI window from LINES/COLUMNS 31/118 (maximized) to 20/78 (de-maximized), I get a garbled screen (that ^L doesn't fix) and a message: ... @@ resize done 0, size = 77x20 ... with the resulting width being 77 instead of the expected 78. [ The discrepancy also manifests in CLI, filed as PR30346. ] The discrepancy comes from tui_resize_all, where we ask readline for the screen size: ... rl_get_screen_size (&screenheight, &screenwidth); ... As it happens, when TERM is set to ansi, readline decides that the terminal cannot auto-wrap lines, and reserves one column to deal with that, and as a result reports back one less than the actual screen width: ... $ echo $COLUMNS 78 $ TERM=xterm gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 78. $ TERM=ansi gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 77. ... In tui_resize_all, we need the actual screen width, and using a screenwidth of one less than the actual value garbles the screen. This is currently not causing trouble in testing because we have a workaround in place in proc Term::resize. If we disable the workaround: ... - stty columns [expr {$_cols + 1}] < $::gdb_tty_name + stty columns $_cols < $::gdb_tty_name ... and dump the screen we get the same type of screen garbling: ... 0 +---------------------------------------+| 1 || 2 || 3 || ... Another way to reproduce the problem is using command "maint info screen". After starting gdb with TERM=ansi, entering TUI, and issuing the command, we get: ... Number of characters curses thinks are in a line is 78. ... and after maximizing and demaximizing the window we get: ... Number of characters curses thinks are in a line is 77. ... If we use TERM=xterm, we do get the expected 78. Fix this by: - detecting when readline will report back less than the actual screen width, - accordingly setting a new variable readline_hidden_cols, - using readline_hidden_cols in tui_resize_all to fix the resize problem, and - removing the workaround in Term::resize. The test-case gdb.tui/empty.exp serves as regression test. I've applied the same fix in tui_async_resize_screen, the new test-case gdb.tui/resize-2.exp serves as a regression test for that change. Without that fix, we have: ... FAIL: gdb.tui/resize-2.exp: again: gdb width 80 ... Tested on x86_64-linux. PR tui/30337 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30337
2023-03-27Use gdb_gmp for scalar arithmeticTom Tromey1-7/+0
This changes gdb to use scalar arithmetic for expression evaluation. I suspect this patch is not truly complete, as there may be code paths that still don't correctly handle 128-bit integers. However, many things do work now. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30190
2023-02-27Remove old GNU indent directivesTom Tromey1-2/+0
Now that gdb_indent.sh has been removed, I think it makes sense to also remove the directives intended for GNU indent.
2023-01-05gdbsupport: move fast_hash to gdbsupport/common-utils.hSimon Marchi1-19/+0
The following patch adds a hash type for gdb::string_view in gdbsupport, which will use the fast_hash function. Move the latter to gdbsupport. Change-Id: Id74510e17801e775bd5ffa5f443713d79adf14ad Approved-By: Andrew Burgess <aburgess@redhat.com>
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-12-16[aarch64] Fix removal of non-address bits for PAuthLuis Machado1-3/+0
PR gdb/28947 The address_significant gdbarch setting was introduced as a way to remove non-address bits from pointers, and it is specified by a constant. This constant represents the number of address bits in a pointer. Right now AArch64 is the only architecture that uses it, and 56 was a correct option so far. But if we are using Pointer Authentication (PAuth), we might use up to 2 bytes from the address space to store the required information. We could also have cases where we're using both PAuth and MTE. We could adjust the constant to 48 to cover those cases, but this doesn't cover the case where GDB needs to sign-extend kernel addresses after removal of the non-address bits. This has worked so far because bit 55 is used to select between kernel-space and user-space addresses. But trying to clear a range of bits crossing the bit 55 boundary requires the hook to be smarter. The following patch renames the gdbarch hook from significant_addr_bit to remove_non_address_bits and passes a pointer as opposed to the number of bits. The hook is now responsible for removing the required non-address bits and sign-extending the address if needed. While at it, make GDB and GDBServer share some more code for aarch64 and add a new arch-specific testcase gdb.arch/aarch64-non-address-bits.exp. Bug-url: https://sourceware.org/bugzilla/show_bug.cgi?id=28947 Approved-By: Simon Marchi <simon.marchi@efficios.com>
2022-12-15Move streq and compare_cstrings to gdbsupportTom Tromey1-12/+0
It seems to me that streq and compare_cstrings belong near the other string utility functions in common-utils.h; and furthermore that streq ought to be inlined. This patch makes this change. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2022-12-15Remove subset_compareTom Tromey1-2/+0
I stumbled across subset_compare today, and after looking at the callers I realized it could be removed and replaced with calls to startswith. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2022-06-08gdb: make throw_perror_with_name staticAndrew Burgess1-3/+0
The throw_perror_with_name function is not used outside of utils.c right now. And as perror_with_name is just a wrapper around throw_perror_with_name, then any future calls would be to perror_with_name. Lets make throw_perror_with_name static. There should be no user visible changes after this commit.
2022-04-15Return void from gdb_putcTom Tromey1-2/+2
I don't think it's very useful to return the character from gdb_putc, so this patch changes it to return void.
2022-03-29Minor comment updates in utils.hTom Tromey1-19/+13
This patch updates some comments in utils.h to more closely reflect the new reality.
2022-03-29Remove vfprintf_styledTom Tromey1-6/+0
Nothing calls vfprintf_styled any more, so remove it.
2022-03-29Rename fprintf_symbol_filteredTom Tromey1-2/+2
fprintf_symbol_filtered is misnamed, because whether filtering happens is now up to the stream. This renames it to fprintf_symbol, which isn't a great name (the first "f" doesn't mean much and the second one is truly meaningless here), but "print_symbol" was already taken.
2022-03-29Rename puts_filtered_tabularTom Tromey1-1/+1
puts_filtered_tabular is now misnamed, because whether filtering happens is now up to the stream. So, rename it. (This function is pretty weird, and should probably be rewritten to avoid using the chars_printed global, and moved into objc-lang.c. However, I haven't done so.)
2022-03-29Rename print_spaces_filteredTom Tromey1-1/+1
print_spaces_filtered is now misnamed, because whether filtering happens is up to the stream. So, rename it.
2022-03-29Unify gdb printf functionsTom Tromey1-6/+3
Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script.
2022-03-29Unify gdb putc functionsTom Tromey1-4/+2
Now that filtered and unfiltered output can be treated identically, we can unify the putc family of functions. This is done under the name "gdb_putc". Most of this patch was written by script.
2022-03-29Unify gdb puts functionsTom Tromey1-5/+3
Now that filtered and unfiltered output can be treated identically, we can unify the puts family of functions. This is done under the name "gdb_puts". Most of this patch was written by script.
2022-03-29Unify vprintf functionsTom Tromey1-7/+2
Now that filtered and unfiltered output can be treated identically, we can unify the vprintf family of functions: vprintf_filtered, vprintf_unfiltered, vfprintf_filtered and vfprintf_unfiltered. (For the gdb_stdout variants, recall that only printf_unfiltered gets truly unfiltered output at this point.) This removes one such function and renames the remaining two to "gdb_vprintf". All callers are updated. Much of this patch was written by script.
2022-03-29Remove fputs_styled_unfilteredTom Tromey1-6/+0
fputs_styled_unfiltered is only called from cli_ui_out, so remove it. This area will be further simplified in future patches.
2022-03-29Change the pager to a ui_fileTom Tromey1-4/+0
This rewrites the output pager as a ui_file implementation. A new header is introduced to declare the pager class. The implementation remains in utils.c for the time being, because there are some static globals there that must be used by this code. (This could be cleaned up at some future date.) I went through all the text output in gdb to ensure that this change should be ok. There are a few cases: * Any existing call to printf_unfiltered is required to be avoid the pager. This is ensured directly in the implementation. * All remaining calls to the f*_unfiltered functions -- the ones that take an explicit ui_file -- either send to an unfiltered stream (e.g., gdb_stderr), which is obviously ok; or conditionally send to gdb_stdout I investigated all such calls by searching for: grep -e '\bf[a-z0-9_]*_unfiltered' *.[chyl] */*.[ch] | grep -v gdb_stdlog | grep -v gdb_stderr This yields a number of candidates to check. * The breakpoint _print_recreate family, and save_trace_state_variables. These are used for "save" commands and so are fine. * Things printing to a temporary stream. Obviously ok. * Disassembly selftests. * print_gdb_help - this is non-obvious, but ok because paging isn't yet enabled at this point during startup. * serial.c - doens't use gdb_stdout * The code in compile/. This is all printing to a file. * DWARF DIE dumping - doesn't reference gdb_stdout. * Calls to the _filtered form -- these are all clearly ok, because if they are using gdb_stdout, then filtering will still apply; and if not, then filtering never applied and still will not. Therefore, at this point, there is no longer any distinction between all the other _filtered and _unfiltered calls, and they can be unified. In this patch, take special note of the vfprintf_maybe_filtered and ui_file::vprintf change. This is one instance of the above idea, erasing the distinction between filtered and unfiltered -- in this part of the change, the "unfiltered_output" flag is never passe to cli_ui_out. Subsequent patches will go much further in this direction. Also note the can_emit_style_escape changes in ui-file.c. Checking against gdb_stdout or gdb_stderr was always a bit of a hack; and now it is no longer needed, because this is decision can be more fully delegated to the particular ui_file implementation. ui_file::can_page is removed, because this patch removed the only call to it. I think this is the main part of fixing PR cli/7234. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7234
2022-03-29Remove vfprintf_styled_no_gdbfmtTom Tromey1-8/+0
This removes vfprintf_styled_no_gdbfmt, inlining it at the sole point of call.
2022-03-29Only have one API for unfiltered outputTom Tromey1-4/+0
At the end of this series, the use of unfiltered output will be very restricted -- only places that definitely need it will use it. To this end, I thought it would be good to reduce the number of _unfiltered APIs that are exposed. This patch changes gdb so that only printf_unfiltered exists. (After this patch, the f* variants still exist as well, but those will be removed later.)
2022-03-28Add new timestamped_file classTom Tromey1-0/+3
This adds a "timestamped_file" subclass of ui_file. This class adds a timestamp to its output when appropriate. That is, it follows the rule already used in vfprintf_unfiltered of adding a timestamp at most once per write. The new class is not yet used.
2022-02-24Support template lookups in strncmp_iw_with_modeKeith Seitz1-2/+5
This patch adds support for wild template parameter list matches, similar to how ABI tags or function overloads are now handled. With this patch, users will be able to "gloss over" the details of matching template parameter lists. This is accomplished by adding (yet more) logic to strncmp_iw_with_mode to skip parameter lists if none is explicitly given by the user. Here's a simple example using gdb.linespec/cpls-ops.exp: Before ------ (gdb) ptype test_op_call type = struct test_op_call { public: void operator()(void); void operator()(int); void operator()(long); void operator()<int>(int *); } (gdb) b test_op_call::operator() Breakpoint 1 at 0x400583: test_op_call::operator(). (3 locations) (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x400583 in test_op_call::operator()(int) at cpls-ops.cc:43 1.2 y 0x40058e in test_op_call::operator()() at cpls-ops.cc:47 1.3 y 0x40059e in test_op_call::operator()(long) at cpls-ops.cc:51 The breakpoint at test_op_call::operator()<int> was never set. After ----- (gdb) b test_op_call::operator() Breakpoint 1 at 0x400583: test_op_call::operator(). (4 locations) (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x400583 in test_op_call::operator()(int) at cpls-ops.cc:43 1.2 y 0x40058e in test_op_call::operator()() at cpls-ops.cc:47 1.3 y 0x40059e in test_op_call::operator()(long) at cpls-ops.cc:51 1.4 y 0x4008d0 in test_op_call::operator()<int>(int*) at cpls-ops.cc:57 Similar to how scope lookups work, passing "-qualified" to the break command will cause a literal lookup of the symbol. In the example immediately above, this will cause GDB to only find the three non-template functions.
2022-01-26Convert wrap_here to use integer parameterTom Tromey1-1/+1
I think it only really makes sense to call wrap_here with an argument consisting solely of spaces. Given this, it seemed better to me that the argument be an int, rather than a string. This patch is the result. Much of it was written by a script.
2022-01-18Introduce gdb-hashtab module in gdbsupportTom Tromey1-26/+0
gdb has some extensions and helpers for working with the libiberty hash table. This patch consolidates these and moves them to gdbsupport.
2022-01-18Move gdb_argv to gdbsupportTom Tromey1-174/+0
This moves the gdb_argv class to a new header in gdbsupport.
2022-01-05Implement putstr and putstrn in ui_fileTom Tromey1-15/+0
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-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-12-29Remove unusual use of core_addr_eq and core_addr_hashTom Tromey1-4/+0
gdbtypes.h uses core_addr_eq and core_addr_hash in a weird way: taking the address of a member and then passing this (as a void*) to these functions. It seems better to simply inline the ordinary code here. CORE_ADDR is a scalar so it can be directly compared, and the identity hash function seems safe to assume as well. After this, core_addr_eq and core_addr_hash are unused, so this patch removes them.
2021-12-24Remove gdb_print_host_addressTom Tromey1-7/+0
gdb_print_host_address is just a simple wrapper around fprintf_filtered. However, it is readily replaced in all callers by a combination of %s and call to host_address_to_string. This also simplifies the code, so I think it's worthwhile to remove this function. Regression tested on x86-64 Fedora 64.
2021-12-24Move gdb_bfd_errmsg to gdb_bfd.cTom Tromey1-7/+0
gdb_bfd.c contains most of gdb's BFD-related utility functions. However, gdb_bfd_errmsg is in utils.c. It seemed better to me to move this out of util.[ch] and into the BFD-related file instead. Tested by rebuilding.
2021-12-20Remove print_spacesTom Tromey1-2/+0
This removes the print_spaces helper function, in favor of using the "*%s" idiom that's already used in many places in gdb. One spot (in symmisc.c) is changed to use print_spaces_filtered, because the rest of that function is using filtered output. (This highlights one way that the printf idiom is better -- this error is harder to make when using that.) Regression tested on x86-64 Fedora 34.
2021-12-20Remove puts_debugTom Tromey1-2/+0
I noticed that puts_debug isn't used in the tree. git log tells me that the last use was removed in 2015: commit 40e0b27177e747600d3ec186458fe0e482a1cf77 Author: Pedro Alves <palves@redhat.com> Date: Mon Aug 24 15:40:26 2015 +0100 Delete the remaining ROM monitor targets ... and this commit mentions that the code being removed here probably hadn't worked for 6 years prior to that. Based on this, I'm removing puts_debug. I don't think it's useful. Tested by rebuilding.
2021-12-20Make n_spaces return a const char *Tom Tromey1-1/+1
n_spaces keeps the spaces in a static buffer. If a caller overwrites these, it may give an incorrect result to a subsequent caller. So, make the return type const to help avoid this outcome.
2021-11-08Add a const version of gdb_argv:as_array_viewLancelot SIX1-0/+10
This commits adds const versions for the GET and AS_ARRAX_VIEW methods of gdb_argv. Those methods will be required in the following patch of the series.
2021-05-26Introduce htab_delete_entryTom Tromey1-0/+9
In a bigger series I'm working on, it is convenient to have a libiberty hash table that manages objects allocated with 'new'. To make this simpler, I wrote a small template function to serve as a concise wrapper. Then I realized that this could be reused in a few other places. gdb/ChangeLog 2021-05-26 Tom Tromey <tom@tromey.com> * dwarf2/read.c (allocate_type_unit_groups_table) (handle_DW_AT_stmt_list, allocate_dwo_file_hash_table): Use htab_delete_entry. (free_line_header_voidp): Remove. * completer.c (completion_tracker::completion_hash_entry::deleter): Remove. (completion_tracker::discard_completions): Use htab_delete_entry. * utils.h (htab_delete_entry): New template function.
2021-05-07Remove streq_hash in favor of htab_eq_stringTom Tromey1-5/+0
Now that libiberty includes htab_eq_string, we can remove the identical function from gdb. gdb/ChangeLog 2021-05-07 Tom Tromey <tom@tromey.com> * breakpoint.c (ambiguous_names_p): Use htab_eq_string. * utils.c (streq_hash): Remove. * utils.h (streq_hash): Don't declare. * completer.c (completion_tracker::discard_completions): Update comment. * ada-lang.c (_initialize_ada_language): Use htab_eq_string.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-12-17Remove printfi_filtered and fprintfi_filteredTom Tromey1-5/+0
After seeing Simon's patch, I thought maybe it was finally time to remove printfi_filtered and fprintfi_filtered, in favor of using the "%*s" approach to indenting. In this patch I took the straightforward approach of always adding a leading "%*s", even when the format already started with "%s", to avoid the trickier form of: printf ("%*s", -indent, string) Regression tested on x86-64 Fedora 32. Let me know what you think. gdb/ChangeLog 2020-12-17 Tom Tromey <tromey@adacore.com> * gdbtypes.c (print_args, dump_fn_fieldlists, print_cplus_stuff) (print_gnat_stuff, print_fixed_point_type_info) (recursive_dump_type): Update. * go32-nat.c (go32_sysinfo, display_descriptor): Update. * c-typeprint.c (c_type_print_base_struct_union) (c_type_print_base_1): Update. * rust-lang.c (rust_internal_print_type): Update. * f-typeprint.c (f_language::f_type_print_base): Update. * utils.h (fprintfi_filtered, printfi_filtered): Remove. * m2-typeprint.c (m2_record_fields): Update. * p-typeprint.c (pascal_type_print_base): Update. * compile/compile-loc2c.c (push, pushf, unary, binary) (do_compile_dwarf_expr_to_c): Update. * utils.c (fprintfi_filtered, printfi_filtered): Remove.
2020-12-16[gdb/cli] Add a progress meterTom Tromey1-0/+4
Add a progress meter. It's not used anywhere yet. gdb/ChangeLog: 2020-12-16 Tom Tromey <tom@tromey.com> Tom Tromey <tromey@redhat.com> Tom de Vries <tdevries@suse.de> * utils.h (get_chars_per_line): Declare. * utils.c (get_chars_per_line): New function. (fputs_maybe_filtered): Handle '\r'. * ui-out.h (ui_out::progress_meter): New class. (ui_out::progress, ui_out::do_progress_start) (ui_out::do_progress_notify, ui_out::do_progress_end): New methods. * ui-out.c (do_progress_end) (make_cleanup_ui_out_progress_begin_end, ui_out_progress): New functions. * mi/mi-out.h (mi_ui_out::do_progress_start) (mi_ui_out::do_progress_notify, mi_ui_out::do_progress_end): New methods. * cli-out.h (struct cli_ui_out) <do_progress_start, do_progress_notify, do_progress_end>: New methods. <enum meter_stat, struct cli_progress_info>: New. <m_meters>: New member. * cli-out.c (cli_ui_out::do_progress_start) (cli_ui_out::do_progress_notify, cli_ui_out::do_progress_end): New methods.