aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-03-29Rename print_spaces_filteredTom Tromey17-47/+47
print_spaces_filtered is now misnamed, because whether filtering happens is up to the stream. So, rename it.
2022-03-29Unify gdb printf functionsTom Tromey249-8470/+8456
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 Tromey26-78/+62
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 Tromey86-1204/+1196
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 Tromey15-72/+30
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 Tromey3-21/+10
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 Tromey10-192/+230
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 Tromey3-28/+8
This removes vfprintf_styled_no_gdbfmt, inlining it at the sole point of call.
2022-03-29Add style-escape methods to ui_fileTom Tromey2-0/+43
This adds emit_style_escape and reset_style methods to ui_file. These aren't used yet, but they will be once the pager is converted to be a ui_file subclass.
2022-03-29Add puts_unfiltered method to ui_fileTom Tromey2-1/+17
When the pager is rewritten as a ui_file, gdb will still need a way to bypass the filtering. After examining a few approaches, I chose this patch, which adds a puts_unfiltered method to ui_file. For most implementations of ui_file, this will just delegate to puts. This patch also switches printf_unfiltered to use the new method.
2022-03-29Only have one API for unfiltered outputTom Tromey4-27/+3
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-29Remove some uses of printf_unfilteredTom Tromey16-74/+74
A number of spots call printf_unfiltered only because they are in code that should not be interrupted by the pager. However, I believe these cases are all handled by infrun's blanket ban on paging, and so can be converted to the default (_filtered) API. After this patch, I think all the remaining _unfiltered calls are ones that really ought to be. A few -- namely in complete_command -- could be replaced by a scoped assignment to pagination_enabled, but for the remainder, the code seems simple enough like this.
2022-03-29Use unfiltered output in annotate.cTom Tromey1-74/+74
It seems to me that annotations should not be filtered. While it might be weird for an annotation-based UI to use the pager, it's not, I think, out of the question. This patch makes this change.
2022-03-29gdb/remote: use current_inferior in read_ptid if multi-process not supportedTankut Baris Aktemur3-4/+127
When parsing the ptid out of a reply package, if the multi-process extensions are not supported, use current_inferior's pid as the pid of the reported thread, instead of inferior_ptid. This is needed because the inferior_ptid may be null_ptid although a legit context exists, due to a prior context switch via switch_to_inferior_no_thread. Below is a scenario that illustrates what could go wrong. First, setup a multi-target scenario. This is needed, because in a multi-target setting, the inferior_ptid is cleared out before waiting on targets. The second inferior below sits on top of a remote target. Multi-process packets are disabled. $ # First, spawn a process with PID 26253 to attach to later. $ gdb-up a.out Reading symbols from a.out... (gdb) maint set target-non-stop on (gdb) set remote multiprocess-feature-packet off (gdb) start ... (gdb) add-inferior -no-connection [New inferior 2] Added inferior 2 (gdb) inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] (gdb) target extended-remote | gdbserver --multi - Remote debugging using | gdbserver --multi - Remote debugging using stdio (gdb) attach 26253 Attaching to Remote target Attached; pid = 26253 [New Thread 26253] [New inferior 3] Reading /tmp/a.out from remote target... ... [New Thread 26253] ... Reading /usr/local/lib/debug/....debug from remote target... >>> GDB seems to hang here. After attaching to a process and reading some library files, GDB seems to hang. One interesting thing to note is that [New Thread 26253] appears twice. We also see [New inferior 3] Running the same scenario with "debug infrun on" reveals more details. ... (gdb) attach 26253 [infrun] scoped_disable_commit_resumed: reason=attaching Attaching to Remote target Attached; pid = 26253 [New Thread 26253] [infrun] infrun_async: enable=1 [infrun] attach_command: immediately after attach: [infrun] attach_command: thread 26253.26253.0, executing = 1, resumed = 0, state = RUNNING [infrun] clear_proceed_status_thread: 26253.26253.0 [infrun] reset: reason=attaching [infrun] maybe_set_commit_resumed_all_targets: not requesting commit-resumed for target native, no resumed threads [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target extended-remote [infrun] fetch_inferior_event: enter [infrun] scoped_disable_commit_resumed: reason=handling event [infrun] do_target_wait: Found 2 inferiors, starting at #1 [infrun] random_pending_event_thread: None found. [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) = [infrun] print_target_wait_results: 26253.26253.0 [Thread 26253], [infrun] print_target_wait_results: status->kind = STOPPED, sig = GDB_SIGNAL_0 [infrun] handle_inferior_event: status->kind = STOPPED, sig = GDB_SIGNAL_0 [infrun] start_step_over: enter [infrun] start_step_over: stealing global queue of threads to step, length = 0 [infrun] operator(): step-over queue now empty [infrun] start_step_over: exit [infrun] context_switch: Switching context from 0.0.0 to 26253.26253.0 [infrun] handle_signal_stop: stop_pc=0x7f849d8cf151 [infrun] stop_waiting: stop_waiting [infrun] stop_all_threads: starting [infrun] stop_all_threads: pass=0, iterations=0 [New inferior 3] Reading /tmp/a.out from remote target... warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. Reading /tmp/a.out from remote target... Reading symbols from target:/tmp/a.out... [New Thread 26253] [infrun] stop_all_threads: 4723.4723.0 not executing [infrun] stop_all_threads: 26253.26253.0 not executing [infrun] stop_all_threads: 42000.26253.0 executing, need stop [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) = [infrun] print_target_wait_results: -1.0.0 [Thread 0], [infrun] print_target_wait_results: status->kind = IGNORE [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) = [infrun] print_target_wait_results: -1.0.0 [Thread 0], [infrun] print_target_wait_results: status->kind = IGNORE GDB tried to stop Thread 42000.26253.0, which does not exist, and we are waiting for a stop event that will never happen. The PID in '42000.26253.0', namely 42000, is the PID of magic_null_ptid. It comes from gdb/remote.c:read_ptid: /* Since the stub is not sending a process id, then default to what's in inferior_ptid, unless it's null at this point. If so, then since there's no way to know the pid of the reported threads, use the magic number. */ if (inferior_ptid == null_ptid) pid = magic_null_ptid.pid (); else pid = inferior_ptid.pid (); if (obuf) *obuf = pp; return ptid_t (pid, tid); Because multi-process was turned off, GDB did not parse an explicitly specified PID. Furthermore, inferior_ptid == null_ptid, and eventually GDB picked the PID from magic_null_ptid. If target-non-stop is not turned on at the beginning, the same bug reveals itself as a duplicated thread as shown below. # Same setup as above, without 'maint set target-non-stop on'. ... (gdb) attach 26253 Attaching to Remote target Attached; pid = 26253 [New inferior 3] ... [New Thread 26253] ... (gdb) info threads Id Target Id Frame 1.1 process 13517 "a.out" main () at test.c:3 * 2.1 Thread 26253 "a.out" 0x00007f12750c5151 in read () from target:/lib/x86_64-linux-gnu/libc.so.6 3.1 Thread 26253 "a.out" Remote 'g' packet reply is too long (expected 560 bytes, got 2496 bytes): 00feffffffffffff000a3a75127f000051510c75127f0000000400000000000060d24ef6af5500000000000000000000680d000000000000b85b31e3fc7f0000c0283a75127f000000e55b75127f000010d04ef6af550000460200000000000060c73975127f0000a0d23975127f0000000a3a75127f0000000000000000000051510c75127f000046020000330000002b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000080143a75127f000080143a75127f000040143a75127f000040143a75127f00007d0000007e0000007f00000080000000300c3a75127f0000300c3a75127f00000e000000000000000e0000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff0400000004000000040000000400000020143a75127f000020143a75127f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000000000000000000000e55b75127f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (gdb) Fix the problem by preferring current_inferior()'s pid instead of magic_null_ptid. Regression-tested on X86-64 Linux. Co-authored-by: Aleksandar Paunovic <aleksandar.paunovic@intel.com>
2022-03-29gdb/testsuite: fix test failure when building against readline v7Andrew Burgess1-1/+1
The test added in the commit: commit a6b413d24ccc5d76179bab866834e11fd6fec294 Date: Fri Mar 11 14:44:03 2022 +0000 gdb: work around prompt corruption caused by bracketed-paste-mode Was not written with readline 7 in mind, only readline 8+. Between readline 7 and 8 the escape sequence used to disable bracketed paste mode changed, an additional '\r' character was added to the end. In fact, it was the addition of this '\r' character that triggered the issue for which the above commit is part of the solution. Anyway, the test tries to spot the case where the output from GDB is not perfect, but does have the above work around applied. However, the pattern in the test assumes that the problematic '\r' will be present, and this is only true for readline 8+. With readline 7 the test was failing. In this commit I generalise the pattern a little so that the test will still KFAIL with readline 7. It's a little unfortunate that the test is KFAILing with readline 7, as without the problematic '\r' there's actually no reason that GDB couldn't "do the right thing" in this case, in which case, the test would PASS, but that would require changes within GDB itself. My preference then is that initially we patch the test to get it KFAILing, then in a separate commit I can modify GDB so that it can PASS with readline 7.
2022-03-29gdb/testsuite: fix copy & paste error in gdb.python/py-format-address.expAndrew Burgess1-3/+4
The test gdb.python/py-format-address.exp, added in commit: commit 25209e2c6979c3838e14e099f0333609810db280 Date: Sat Oct 23 09:59:25 2021 +0100 gdb/python: add gdb.format_address function included 3 copy & paste errors where the wrong address was used in the expected output patterns. The test compiles two almost identical test binaries (one function changes its name, that's the only difference), two inferiors are created, each inferior using one of the test binaries. We then take the address of the name changing function in both inferiors ('foo' in inferior 1 and 'bar' in inferior 2) and the tests are carried out using these addresses. What we're checking for is that symbols 'foo' and 'bar' show up in the correct inferior, and that (as this test is for a Python API feature), the user can have one inferior selected, but ask about the other inferior, and see the correct symbol in the result. The hope is that the two binaries will be laid out identically by the compiler, and that 'foo' and 'bar' will be at the same address. This is fine, unless the executable is compiled as PIE (position independent executable), in which case there is a problem. The problem is that though inferior 1 is set running, the inferior 2 never is. If the executables are compiled as PIE, then the address in the inferior 2 will not have been resolved, while the address in the inferior 1 will have been, and so the two addresses we use in the tests will be different. This issue was reported here: https://sourceware.org/pipermail/gdb-patches/2022-March/186911.html The first part of the fix is to use the correct address variable in the expected output patterns, with this change the tests pass even when the executables are compiled as PIE. A second part of this fix is to pass the 'nopie' option when we compile the tests, this should ensure that the address obtained in inferior 2 is the same as the address from inferior 1, which makes the test more useful.
2022-03-29gdb/mi: fix use after free of frame_info causing spurious notificationsAndrew Burgess1-10/+34
In commit: commit a2757c4ed693cef4ecc4dcdcb2518353eb6b3c3f Date: Wed Mar 16 15:08:22 2022 +0000 gdb/mi: consistently notify user when GDB/MI client uses -thread-select Changes were made to GDB to address some inconsistencies in when notifications are sent from a MI terminal to a CLI terminal (when multiple terminals are in use, see new-ui command). Unfortunately, in order to track when the currently selected frame has changed, that commit grabs a frame_info pointer before and after an MI command has executed, and compares the pointers to see if the frame has changed. This is not safe. If the frame cache is deleted for any reason then the frame_info pointer captured before the command started, is no longer valid, and any comparisons based on that pointer are undefined. This was leading to random test failures for some folk, see: https://sourceware.org/pipermail/gdb-patches/2022-March/186867.html This commit changes GDB so we no longer hold frame_info pointers, but instead store the frame_id and frame_level, this is safe even when the frame cache is flushed.
2022-03-29bfd/Dwarf2: gas doesn't mangle namesJan Beulich1-0/+1
Include the language identifier emitted by gas in the set of ones where no mangled names are expected. Even if there could be "hand-mangled" names, gas doesn't emit DW_AT_linkage_name in the first place.
2022-03-29bfd/Dwarf2: make find-nearest-line returned function name consistentJan Beulich1-2/+3
Prior to entering the enclosing "else if()" the earlier associated if() checks function->is_linkage and, if set, uses function->name. The comment in patch context precedes (and explains) the setting function->is_linkage. Yet with the flag set, we should then also return the function name, just like said earlier if() would do when we came here a 2nd time for the same "addr". And indeed passing the same address twice on addr2line's command line would resolve the function for the 2nd instance, but not for the 1st (if this code path is taken). (This, obviously, is particularly relevant when there's no ELF symbol table in the first place, like would be the case - naturally - in PE/COFF binaries, for example.)
2022-03-29gas/Dwarf: special-case .linefile only for macrosJan Beulich3-1/+29
Restrict the PR gas/16908 workaround to just macros, matching the original intention as well as the comment there. For constructs like .irp or .rept the reasoning doesn't apply, as there's no separate "invocation" point which may be of interest to record (for, as said there, short macros).
2022-03-29RISC-V: correct FCVT.Q.L[U]Jan Beulich2-4/+4
While the spec isn't explicit about this, it pointing out the similarity with the D extension ought to extend to the ignoring of a meaningless rounding mode: "Note FCVT.D.W[U] always produces an exact result and is unaffected by rounding mode." Hence the chosen encodings also ought to match. Note that to avoid breaking existing code the forms with a 3rd operand are not removed, which means there continues to be a difference to FCVT.D.W[U].
2022-03-28sim: add arch/.gdbinit stub scriptsMike Frysinger4-34/+169
Make it easy to load the common gdbinit script even when running in the arch/ subdir instead of the top-level sim dir.
2022-03-29asan: heap buffer overflow in pa_chk_field_selectorAlan Modra1-16/+29
The buffer overflow showed up running the gas "all macro" test. PR 29005 * config/tc-hppa.c (pa_chk_field_selector): Don't read past end of line.
2022-03-29Automatic date update in version.inGDB Administrator1-1/+1
2022-03-28Add Rust parser check for end of expressionTom Tromey2-1/+7
I noticed that "print 5," passed in Rust -- the parser wasn't checking that the entire input was used. This patch fixes the problem. This in turn pointed out another bug in the parser, namely that it didn't lex the next token after handling a string token. This is also fixed here.
2022-03-28Switch gdb_stdlog to use timestamped_fileTom Tromey4-33/+13
Currently, timestamps for logging are done by looking for the use of gdb_stdlog in vfprintf_unfiltered. This seems potentially buggy, in that during logging or other redirects (like execute_fn_to_ui_file) we might have gdb_stdout==gdb_stdlog and so, conceivably, wind up with timestamps in a log when they were not desired. It seems better, instead, for timestamps to be a property of the ui_file itself. This patch changes gdb to use the new timestamped_file for gdb_stdlog where appropriate, and removes the special case from vfprintf_unfiltered. Note that this may somewhat change the output in some cases -- in particular, when going through execute_fn_to_ui_file (or the _string variant), timestamps won't be emitted. This could be fixed in those functions, but it wasn't clear to me whether this is really desirable. Note also that this changes the TUI to send gdb_stdlog to gdb_stderr. I imagine that the previous use of gdb_stdout here was inadvertent. (And in any case it probably doesn't matter.)
2022-03-28Add new timestamped_file classTom Tromey4-1/+57
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-03-28Use unique_ptr in CLI logging codeTom Tromey1-26/+17
This changes the CLI logging code to avoid manual memory management (to the extent possible) by using unique_ptr in a couple of spots. This will come in handy in a later patch.
2022-03-28Simplify the CLI set_logging logicTom Tromey1-16/+4
The CLI's set_logging logic seemed unnecessarily complicated to me. This patch simplifies it, with an eye toward changing it to use RAII objects in a subsequent patch. I did not touch the corresponding MI code. That code seems incorrect (nothing ever uses raw_stdlog, and nothing ever sets saved_raw_stdlog). I didn't attempt to fix this, because I question whether this is even useful for MI.
2022-03-28Handle multiple addresses in call_site_targetTom Tromey3-0/+62
A large customer program has a function that is partitioned into hot and cold parts. A variable in a callee of this function is described using DW_OP_GNU_entry_value, but gdb gets confused when trying to find the caller. I tracked this down to dwarf2_get_pc_bounds interpreting the function's changes so that the returned low PC is the "wrong" function. Intead, when processing DW_TAG_call_site, the low PC of each range in DW_AT_ranges should be preserved in the call_site_target. This fixes the variable lookup in the test case I have. I didn't write a standalone test for this as it seemed excessively complicated.
2022-03-28Change call_site_target to iterate over addressesTom Tromey2-63/+105
In order to handle the case where a call site target might refer to multiple addresses, we change the code to use a callback style. Any spot using call_site_target::address now passes in a callback function that may be called multiple times.
2022-03-28Change call_site_find_chain_1 to work recursivelyTom Tromey2-74/+64
call_site_find_chain_1 has a comment claiming that recursive calls would be too expensive. However, I doubt this is so expensive; and furthermore the explicit state management approach here is difficult both to understand and to modify. This patch changes this code to use explicit recursion, so that a subsequent patch can generalize this code without undue trauma. Additionally, I think this patch detects a latent bug in the recursion code. (It's hard for me to be completely certain.) The bug is that when a new target_call_site is entered, the code does: if (target_call_site) { if (addr_hash.insert (target_call_site->pc ()).second) { /* Successfully entered TARGET_CALL_SITE. */ chain.push_back (target_call_site); break; } } Here, if entering the target_call_site fails, then any tail_call_next elements in this call site are not visited. However, if this code does happen to enter a call site, then the tail_call_next elements will be visited during backtracking. This applies when doing the backtracking as well -- it will only continue through a given chain as long as each element in the chain can successfully be visited. I'd appreciate some review of this. If this behavior is intentional, it can be added to the new implementation.
2022-03-28Constify chain_candidateTom Tromey1-8/+8
While investigating this bug, I wasn't sure if chain_candidate might update 'chain'. I changed it to accept a const reference, making it clear that it cannot. This simplifies the code a tiny bit as well.
2022-03-28Make call_site_target members privateTom Tromey2-37/+33
This makes the data members of call_site_target 'private'. This lets us remove most of its public API. call_site_to_target_addr is changed to be a method of this type. This is a preparatory refactoring for the fix at the end of this series.
2022-03-28Change call_site_target to use custom type and enumTom Tromey2-13/+31
call_site_target reuses field_loc_kind and field_location. However, it has never used the full range of the field_loc_kind enum. In a subsequent patch, I plan to add a new 'kind' here, so it seemed best to avoid this reuse and instead introduce new types here.
2022-03-28Automatic date update in version.inGDB Administrator1-1/+1
2022-03-27Automatic date update in version.inGDB Administrator1-1/+1
2022-03-26Remove an unused declaration from value.hTom Tromey1-4/+0
value.h has a declaration of value_print_array_elements that is incorrect. In C, this would have been an error, but in C++ this is a declaration of an overload that is neither defined nor used. This patch removes the declaration.
2022-03-26Automatic date update in version.inGDB Administrator1-1/+1
2022-03-25libtool.m4: fix the NM="/nm/over/here -B/option/with/path" caseNick Alcock12-147/+244
My previous nm patch handled all cases but one -- if the user set NM in the environment to a path which contained an option, libtool's nm detection tries to run nm against a copy of nm with the options in it: e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle". This is unlikely to be desirable: in this case we should run "/usr/bin/nm --blargle /usr/bin/nm". Furthermore, as part of this nm has to detect when the passed-in $NM contains a path, and in that case avoid doing a path search itself. This too was thrown off if an option contained something that looked like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run "nm -B../prev-gcc nm" which rarely works well (and indeed it looks to see whether that nm exists, finds it doesn't, and wrongly concludes that nm -p or whatever does not work). Fix all of these by clipping all options (defined as everything including and after the first " -") before deciding whether nm contains a path (but not using the clipped value for anything else), and then removing all options from the path-modified nm before looking to see whether that nm existed. NM=my-nm now does a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM=/usr/bin/my-nm now avoids a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM="my-nm -p../wombat" now does a path search and runs e.g. /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search: ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm This seems to be all combinations, including those used by GCC bootstrap (which, before this commit, fails to bootstrap when configured --with-build-config=bootstrap-lto, because the lto plugin is now using --export-symbols-regex, which requires libtool to find a working nm, while also using -B../prev-gcc to point at the lto plugin associated with the GCC just built.) Regenerate all affected configure scripts. * libtool.m4 (LT_PATH_NM): Handle user-specified NM with options, including options containing paths.
2022-03-25Re: gas/Dwarf: improve debug info generation from .irp and alike blocksAlan Modra1-2/+2
am33_2.0-linux is a mn10300 target. * testsuite/gas/elf/dwarf-5-irp.d: xfail am33.
2022-03-25Automatic date update in version.inGDB Administrator1-1/+1
2022-03-24Remove download size from debuginfod progress messages if unavailableAaron Merey1-18/+26
Currently debuginfod progress update messages include the size of each download: Downloading 7.5 MB separate debug info for /lib/libxyz.so.0 This value originates from the Content-Length HTTP header of the transfer. However this header is not guaranteed to be present for each download. This can happen when debuginfod servers compress files on-the-fly at the time of transfer. In this case gdb wrongly prints "-0.00 MB" as the size. This patch removes download sizes from progress messages when they are not available. It also removes usage of the progress bar until a more thorough reworking of progress updating is implemented. [1] [1] https://sourceware.org/pipermail/gdb-patches/2022-February/185798.html
2022-03-24sim: fix a comment typo in sim-load.cReuben Thomas1-1/+1
Fix a typo where the documentation refers to a function parameter by the wrong name. Change-Id: I99494efe62cd4aa76fb78a0bd5da438d35740ebe
2022-03-24sim: fix “alligned” typosReuben Thomas3-4/+4
Change-Id: Ifd574e38524dd4f1cf0fc003e0c5c7499abc84a0
2022-03-24x86: mention dropped L1OM/K1OM support in ld/ as wellJan Beulich2-2/+3
This amends e961c696dcb2 ("x86: drop L1OM/K1OM support from ld"). Also remove the marker that I mistakenly added in c085ab00c7b2 ("x86: drop L1OM/K1OM support from gas").
2022-03-24gdb/testsuite: remove gdb.python/pretty-print-call-by-hand.expSimon Marchi3-225/+0
This test was added without a corresponding fix, with some setup_kfails. However, it results in UNRESOLVED results when GDB is built with ASan. ERROR: GDB process no longer exists GDB process exited with wait status 1946871 exp7 0 1 UNRESOLVED: gdb.python/pretty-print-call-by-hand.exp: frame print: backtrace test (PRMS gdb/28856) Remove the test from the tree, I'll attach it to the Bugzilla bug instead [1]. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28856 Change-Id: Id95d8949fb8742874bd12aeac758aa4d7564d678
2022-03-24x86: drop L1OM/K1OM support from ldJan Beulich8-120/+12
This was only rudimentary support anyway; none of the sub-architecture specific insns were ever supported.
2022-03-24x86: drop L1OM special case from disassemblerJan Beulich1-6/+2
There wasn't any real support anyway: None of the sub-architecture specific insns were ever supported.
2022-03-24MAINTAINERS: add myselfJan Beulich1-1/+2
I much appreciate Nick offering this role to me. Nevertheless there's still a lot for me to learn here. At this occasion also update my email address in the pre-existing, much more narrow entry.