aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-07-09Make scoped_restore_current_thread's cdtors exception free (RFC)users/palves/pr26199-busy-loop-target-eventsPedro Alves6-88/+137
If the remote target closes while we're reading registers/memory for restoring the selected frame in scoped_restore_current_thread's dtor, the corresponding TARGET_CLOSE_ERROR error is swallowed by the scoped_restore_current_thread's dtor, because letting exceptions escape from a dtor is bad. It isn't great to lose that errors like that, though. I've been thinking about how to avoid it, and I came up with this patch. The idea here is to make scoped_restore_current_thread's dtor do as little as possible, to avoid any work that might throw in the first place. And to do that, instead of having the dtor call restore_selected_frame, which re-finds the previously selected frame, just record the frame_id/level of the desired selected frame, and have get_selected_frame find the frame the next time it is called. In effect, this implements most of Cagney's suggestion, here: /* On demand, create the selected frame and then return it. If the selected frame can not be created, this function prints then throws an error. When MESSAGE is non-NULL, use it for the error message, otherwize use a generic error message. */ /* FIXME: cagney/2002-11-28: At present, when there is no selected frame, this function always returns the current (inner most) frame. It should instead, when a thread has previously had its frame selected (but not resumed) and the frame cache invalidated, find and then return that thread's previously selected frame. */ extern struct frame_info *get_selected_frame (const char *message); The only thing missing to fully implement that would be to make reinit_frame_cache just clear selected_frame instead of calling select_frame(NULL), and the call select_frame(NULL) explicitly in the places where we really wanted reinit_frame_cache to go back to the current frame too. That can done separately, though, I'm not proposing to do that in this patch. Note that this patch renames restore_selected_frame to lookup_selected_frame, and adds a new restore_selected_frame function that doesn't throw, to be paired with the also-new save_selected_frame function. lookup_selected_frame should really move from thread.c to frame.c, but I didn't do that here, just to avoid churn in the patch while it collects comments. I did make it extern and declared it in frame.h already, preparing for the move. I will do the move as a follow up patch if people agree with this approach. Incidentally, this patch alone would fix the crashes fixed by the previous patches in the series, because with this, scoped_restore_current_thread's constructor doesn't throw either. gdb/ChangeLog: * blockframe.c (block_innermost_frame): Use get_selected_frame. * frame.c (scoped_restore_selected_frame::scoped_restore_selected_frame): Use save_selected_frame. Save language as well. (scoped_restore_selected_frame::~scoped_restore_selected_frame): Use restore_selected_frame, and restore language as well. (selected_frame_id, selected_frame_level): New. (selected_frame): Update comments. (save_selected_frame, restore_selected_frame): New. (get_selected_frame): Use lookup_selected_frame. (get_selected_frame_if_set): Delete. (select_frame): Record selected_frame_level and selected_frame_id. * frame.h (scoped_restore_selected_frame) <m_level, m_lang>: New fields. (get_selected_frame_if_set): Delete declaration. (select_frame): Update comments. (save_selected_frame, restore_selected_frame) (lookup_selected_frame): Declare. * gdbthread.h (scoped_restore_current_thread) <m_lang>: New field. * stack.c (select_frame_command_core, frame_command_core): Use get_selected_frame. * thread.c (restore_selected_frame): Rename to ... (lookup_selected_frame): ... this and make extern. Select the current frame if the frame level is -1. (scoped_restore_current_thread::restore): Also restore the language. (scoped_restore_current_thread::~scoped_restore_current_thread): Don't try/catch. (scoped_restore_current_thread::scoped_restore_current_thread): Save the language as well. Use save_selected_frame.
2020-07-09Fix crash if connection drops in scoped_restore_current_thread's ctor, part 2Pedro Alves1-8/+15
Running the testsuite against an Asan-enabled build of GDB makes gdb.base/multi-target.exp expose this bug. scoped_restore_current_thread's ctor calls get_frame_id to record the selected frame's ID to restore later. If the frame ID hasn't been computed yet, it will be computed on the spot, and that will usually require accessing the target's memory and registers. If the remote connection closes, while we're computing the frame ID, the remote target exits its inferiors, unpushes itself, and throws a TARGET_CLOSE_ERROR error. Exiting the inferiors deletes the inferior's threads. scoped_restore_current_thread increments the current thread's refcount to prevent the thread from being deleted from under its feet. However, the code that does that isn't considering the case of the thread being deleted from within get_frame_id. It only increments the refcount _after_ get_frame_id returns. So if the current thread is indeed deleted, the tp->incref (); statement references a stale TP pointer. Incrementing the refcounts earlier fixes it. We should probably also let the TARGET_CLOSE_ERROR error propagate in this case. That alone would fix it, though it seems better to tweak the refcount handling too. gdb/ChangeLog: * thread.c (scoped_restore_current_thread::scoped_restore_current_thread): Incref the thread before calling get_frame_id instead of after. Let TARGET_CLOSE_ERROR propagate.
2020-07-08Fix crash if connection drops in scoped_restore_current_thread's ctor, part 1Pedro Alves2-3/+28
Running the testsuite against an Asan-enabled build of GDB makes gdb.base/multi-target.exp expose this bug. scoped_restore_current_thread's ctor calls get_frame_id to record the selected frame's ID to restore later. If the frame ID hasn't been computed yet, it will be computed on the spot, and that will usually require accessing the target's memory and registers, which requires remote accesses. If the remote connection closes while we're computing the frame ID, the remote target exits its inferiors, unpushes itself, and throws a TARGET_CLOSE_ERROR error. If that happens, GDB can currently crash, here: > ==18555==ERROR: AddressSanitizer: heap-use-after-free on address 0x621004670aa8 at pc 0x0000007ab125 bp 0x7ffdecaecd20 sp 0x7ffdecaecd10 > READ of size 4 at 0x621004670aa8 thread T0 > #0 0x7ab124 in dwarf2_frame_this_id src/binutils-gdb/gdb/dwarf2/frame.c:1228 > #1 0x983ec5 in compute_frame_id src/binutils-gdb/gdb/frame.c:550 > #2 0x9841ee in get_frame_id(frame_info*) src/binutils-gdb/gdb/frame.c:582 > #3 0x1093faa in scoped_restore_current_thread::scoped_restore_current_thread() src/binutils-gdb/gdb/thread.c:1462 > #4 0xaee5ba in fetch_inferior_event(void*) src/binutils-gdb/gdb/infrun.c:3968 > #5 0xaa990b in inferior_event_handler(inferior_event_type, void*) src/binutils-gdb/gdb/inf-loop.c:43 > #6 0xea61b6 in remote_async_serial_handler src/binutils-gdb/gdb/remote.c:14161 > #7 0xefca8a in run_async_handler_and_reschedule src/binutils-gdb/gdb/ser-base.c:137 > #8 0xefcd23 in fd_event src/binutils-gdb/gdb/ser-base.c:188 > #9 0x15a7416 in handle_file_event src/binutils-gdb/gdbsupport/event-loop.cc:548 > #10 0x15a7c36 in gdb_wait_for_event src/binutils-gdb/gdbsupport/event-loop.cc:673 > #11 0x15a5dbb in gdb_do_one_event() src/binutils-gdb/gdbsupport/event-loop.cc:215 > #12 0xbfe62d in start_event_loop src/binutils-gdb/gdb/main.c:356 > #13 0xbfe935 in captured_command_loop src/binutils-gdb/gdb/main.c:416 > #14 0xc01d39 in captured_main src/binutils-gdb/gdb/main.c:1253 > #15 0xc01dc9 in gdb_main(captured_main_args*) src/binutils-gdb/gdb/main.c:1268 > #16 0x414ddd in main src/binutils-gdb/gdb/gdb.c:32 > #17 0x7f590110b82f in __libc_start_main ../csu/libc-start.c:291 > #18 0x414bd8 in _start (build/binutils-gdb/gdb/gdb+0x414bd8) What happens is that above, we're in dwarf2_frame_this_id, just after the dwarf2_frame_cache call. The "cache" variable that the dwarf2_frame_cache function returned is already stale. It's been released here, from within the dwarf2_frame_cache: (top-gdb) bt #0 reinit_frame_cache () at src/gdb/frame.c:1855 #1 0x00000000014ff7b0 in switch_to_no_thread () at src/gdb/thread.c:1301 #2 0x0000000000f66d3e in switch_to_inferior_no_thread (inf=0x615000338180) at src/gdb/inferior.c:626 #3 0x00000000012f3826 in remote_unpush_target (target=0x6170000c5900) at src/gdb/remote.c:5521 #4 0x00000000013097e0 in remote_target::readchar (this=0x6170000c5900, timeout=2) at src/gdb/remote.c:9137 #5 0x000000000130be4d in remote_target::getpkt_or_notif_sane_1 (this=0x6170000c5900, buf=0x6170000c5918, forever=0, expecting_notif=0, is_notif=0x0) at src/gdb/remote.c:9683 #6 0x000000000130c8ab in remote_target::getpkt_sane (this=0x6170000c5900, buf=0x6170000c5918, forever=0) at src/gdb/remote.c:9790 #7 0x000000000130bc0d in remote_target::getpkt (this=0x6170000c5900, buf=0x6170000c5918, forever=0) at src/gdb/remote.c:9623 #8 0x000000000130838e in remote_target::remote_read_bytes_1 (this=0x6170000c5900, memaddr=0x7fffffffcdc0, myaddr=0x6080000ad3bc "", len_units=64, unit_size=1, xfered_len_units=0x7fff6a29b9a0) at src/gdb/remote.c:8860 #9 0x0000000001308bd2 in remote_target::remote_read_bytes (this=0x6170000c5900, memaddr=0x7fffffffcdc0, myaddr=0x6080000ad3bc "", len=64, unit_size=1, xfered_len=0x7fff6a29b9a0) at src/gdb/remote.c:8987 #10 0x0000000001311ed1 in remote_target::xfer_partial (this=0x6170000c5900, object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x6080000ad3bc "", writebuf=0x0, offset=140737488342464, len=64, xfered_len=0x7fff6a29b9a0) at src/gdb/remote.c:10988 #11 0x00000000014ba969 in raw_memory_xfer_partial (ops=0x6170000c5900, readbuf=0x6080000ad3bc "", writebuf=0x0, memaddr=140737488342464, len=64, xfered_len=0x7fff6a29b9a0) at src/gdb/target.c:918 #12 0x00000000014bb720 in target_xfer_partial (ops=0x6170000c5900, object=TARGET_OBJECT_RAW_MEMORY, annex=0x0, readbuf=0x6080000ad3bc "", writebuf=0x0, offset=140737488342464, len=64, xfered_len=0x7fff6a29b9a0) at src/gdb/target.c:1148 #13 0x00000000014bc3b5 in target_read_partial (ops=0x6170000c5900, object=TARGET_OBJECT_RAW_MEMORY, annex=0x0, buf=0x6080000ad3bc "", offset=140737488342464, len=64, xfered_len=0x7fff6a29b9a0) at src/gdb/target.c:1380 #14 0x00000000014bc593 in target_read (ops=0x6170000c5900, object=TARGET_OBJECT_RAW_MEMORY, annex=0x0, buf=0x6080000ad3bc "", offset=140737488342464, len=64) at src/gdb/target.c:1419 #15 0x00000000014bbd4d in target_read_raw_memory (memaddr=0x7fffffffcdc0, myaddr=0x6080000ad3bc "", len=64) at src/gdb/target.c:1252 #16 0x0000000000bf27df in dcache_read_line (dcache=0x6060001eddc0, db=0x6080000ad3a0) at src/gdb/dcache.c:336 #17 0x0000000000bf2b72 in dcache_peek_byte (dcache=0x6060001eddc0, addr=0x7fffffffcdd8, ptr=0x6020001231b0 "") at src/gdb/dcache.c:403 #18 0x0000000000bf3103 in dcache_read_memory_partial (ops=0x6170000c5900, dcache=0x6060001eddc0, memaddr=0x7fffffffcdd8, myaddr=0x6020001231b0 "", len=8, xfered_len=0x7fff6a29bf20) at src/gdb/dcache.c:484 #19 0x00000000014bafe9 in memory_xfer_partial_1 (ops=0x6170000c5900, object=TARGET_OBJECT_STACK_MEMORY, readbuf=0x6020001231b0 "", writebuf=0x0, memaddr=140737488342488, len=8, xfered_len=0x7fff6a29bf20) at src/gdb/target.c:1034 #20 0x00000000014bb212 in memory_xfer_partial (ops=0x6170000c5900, object=TARGET_OBJECT_STACK_MEMORY, readbuf=0x6020001231b0 "", writebuf=0x0, memaddr=140737488342488, len=8, xfered_len=0x7fff6a29bf20) at src/gdb/target.c:1076 #21 0x00000000014bb6b3 in target_xfer_partial (ops=0x6170000c5900, object=TARGET_OBJECT_STACK_MEMORY, annex=0x0, readbuf=0x6020001231b0 "", writebuf=0x0, offset=140737488342488, len=8, xfered_len=0x7fff6a29bf20) at src/gdb/target.c:1133 #22 0x000000000164564d in read_value_memory (val=0x60f000029440, bit_offset=0, stack=1, memaddr=0x7fffffffcdd8, buffer=0x6020001231b0 "", length=8) at src/gdb/valops.c:956 #23 0x0000000001680fff in value_fetch_lazy_memory (val=0x60f000029440) at src/gdb/value.c:3764 #24 0x0000000001681efd in value_fetch_lazy (val=0x60f000029440) at src/gdb/value.c:3910 #25 0x0000000001676143 in value_optimized_out (value=0x60f000029440) at src/gdb/value.c:1411 #26 0x0000000000e0fcb8 in frame_register_unwind (next_frame=0x6210066bfde0, regnum=16, optimizedp=0x7fff6a29c200, unavailablep=0x7fff6a29c240, lvalp=0x7fff6a29c2c0, addrp=0x7fff6a29c300, realnump=0x7fff6a29c280, bufferp=0x7fff6a29c3a0 "@\304)j\377\177") at src/gdb/frame.c:1144 #27 0x0000000000e10418 in frame_unwind_register (next_frame=0x6210066bfde0, regnum=16, buf=0x7fff6a29c3a0 "@\304)j\377\177") at src/gdb/frame.c:1196 #28 0x0000000000f00431 in i386_unwind_pc (gdbarch=0x6210043d0110, next_frame=0x6210066bfde0) at src/gdb/i386-tdep.c:1969 #29 0x0000000000e39724 in gdbarch_unwind_pc (gdbarch=0x6210043d0110, next_frame=0x6210066bfde0) at src/gdb/gdbarch.c:3056 #30 0x0000000000c2ea90 in dwarf2_tailcall_sniffer_first (this_frame=0x6210066bfde0, tailcall_cachep=0x6210066bfee0, entry_cfa_sp_offsetp=0x0) at src/gdb/dwarf2/frame-tailcall.c:423 #31 0x0000000000c36bdb in dwarf2_frame_cache (this_frame=0x6210066bfde0, this_cache=0x6210066bfdf8) at src/gdb/dwarf2/frame.c:1198 #32 0x0000000000c36eb3 in dwarf2_frame_this_id (this_frame=0x6210066bfde0, this_cache=0x6210066bfdf8, this_id=0x6210066bfe40) at src/gdb/dwarf2/frame.c:1226 Note that remote_target::readchar in frame #3 throws TARGET_CLOSE_ERROR after that remote_unpush_target in frame #3 returns. The problem is that that TARGET_CLOSE_ERROR is swallowed by value_optimized_out in frame #25. If we fix that one, then we run into dwarf2_tailcall_sniffer_first swallowing the exception in frame #30 too. The attached patch fixes it by making those spots swallow fewer kinds of errors. gdb/ChangeLog: * frame-tailcall.c (dwarf2_tailcall_sniffer_first): Only swallow NO_ENTRY_VALUE_ERROR. * value.c (value_optimized_out): Only swallow OPTIMIZED_OUT_ERROR.
2020-07-06Fix GDB busy loop when interrupting non-stop program (PR 26199)Simon Marchi1-27/+11
When interrupting a program in non-stop, the program gets interrupted correctly, but GDB busy loops (the event loop is always woken up). Here is how to reproduce it: 1. Start GDB: ./gdb -nx --data-directory=data-directory -ex "set non-stop 1" --args /bin/sleep 60 2. Run the program with "run" 3. Interrupt with ^C. 4. Look into htop, see GDB taking 100% CPU Debugging `handle_file_event`, we see that the event source that wakes up the event loop is the linux-nat one: (top-gdb) p file_ptr.proc $5 = (handler_func *) 0xb9cccd <handle_target_event(int, gdb_client_data)> ^^^^^^^^^^^^^^^^^^^ | \-- the linux-nat callback Debugging fetch_inferior_event and do_target_wait, we see that we don't actually call `wait` on the linux-nat target, because inferior_matches returns false: auto inferior_matches = [&wait_ptid] (inferior *inf) { return (inf->process_target () != NULL && (threads_are_executing (inf->process_target ()) || threads_are_resumed_pending_p (inf)) && ptid_t (inf->pid).matches (wait_ptid)); }; because `threads_are_executing` is false. What happens is: 1. User types ctrl-c, that writes in the linux-nat pipe, waking up the event source. 2. linux-nat's wait gets called, the SIGINT event is returned, but before returning, it marks the pipe again, in order for wait to get called again: /* If we requested any event, and something came out, assume there may be more. If we requested a specific lwp or process, also assume there may be more. */ if (target_is_async_p () && ((ourstatus->kind != TARGET_WAITKIND_IGNORE && ourstatus->kind != TARGET_WAITKIND_NO_RESUMED) || ptid != minus_one_ptid)) async_file_mark (); 3. The SIGINT event is handled, the program is stopped, the stop notification is printed. 4. The event loop is woken up again because of the `async_file_mark` of step 2. 5. Because `inferior_matches` returns false, we never call linux-nat's wait, so the pipe stays readable. 6. Goto 4. Pedro says: This commit fixes it by letting do_target_wait call target_wait even if threads_are_executing is false. This will normally result in the target returning TARGET_WAITKIND_NO_RESUMED, and _not_ marking its event source again. This results in infrun only calling into the target only once (i.e., breaking the busy loop). Note that the busy loop bug didn't trigger in all-stop mode because all-stop handles this by unregistering the target from the event loop as soon as it was all stopped -- see inf-loop.c:inferior_event_handler's INF_EXEC_COMPLETE handling. If we remove that non-stop check from inferior_event_handler, and replace the target_has_execution check for threads_are_executing instead, it also fixes the issue for non-stop. I considered that as the final solution, but decided that the solution proposed here instead is just simpler and more future-proof design. With the TARGET_WAITKIND_NO_RESUMED handling fixes done in the previous patches, I think it should be possible to always keep the target registered in the event loop, meaning we could eliminate the target_async(0) call from inferior_event_handler as well as most of the target_async(1) calls in the target backends. That would allow in the future e.g., the remote target reporting asynchronous notifications even if all threads are stopped. I haven't attempted that, though. gdb/ChangeLog: yyyy-mm-dd Simon Marchi <simon.marchi@polymtl.ca> Pedro Alves <pedro@palves.net> PR gdb/26199 * infrun.c (threads_are_resumed_pending_p): Delete. (do_target_wait): Remove threads_are_executing and threads_are_resumed_pending_p checks from the inferior_matches lambda. Update comments.
2020-07-06Testcase for previous handle_no_resumed fixesPedro Alves2-1/+79
This adds a testcase that covers the scenarios described in the previous two commits. gdb/testsuite/ChangeLog: PR gdb/26199 * gdb.multi/multi-target.c (exit_thread): New. (thread_start): Break loop if EXIT_THREAD. * gdb.multi/multi-target.exp (test_no_unwaited_for): New proc. (top level) Call test_no_resumed.
2020-07-06Make handle_no_resumed transfer terminalPedro Alves1-12/+54
Let's consider the same use case as in the previous commit: Say you have two inferiors 1 and 2, each connected to a different target, A and B. Now say you set inferior 2 running, with "continue &". Now you select a thread of inferior 1, say thread 1.2, and continue in the foreground. All other threads of inferior 1 are left stopped. Thread 1.2 exits, and thus target A has no other resumed thread, so it reports TARGET_WAITKIND_NO_RESUMED. At this point, because the threads of inferior 2 are still executing the TARGET_WAITKIND_NO_RESUMED event is ignored. Now, the user types Ctrl-C. Because GDB had previously put inferior 1 in the foreground, the kernel sends the SIGINT to that inferior. However, no thread in that inferior is executing right now, so ptrace never intercepts the SIGINT -- it is never dequeued by any thread. The result is that GDB's CLI is stuck. There's no way to get back the prompt (unless inferior 2 happens to report some event). The fix in this commit is to make handle_no_resumed give the terminal to some other inferior that still has threads executing so that a subsequent Ctrl-C reaches that target first (and then GDB intercepts the SIGINT). This is a bit hacky, but seems like the best we can do with the current design. I think that putting all native inferiors in their own session would help fixing this in a clean way, since with that a Ctrl-C on GDB's terminal will _always_ reach GDB first, and then GDB can decide how to pause the inferior. But that's a much larger change. The testcase added by the following patch needs this fix. gdb/ChangeLog: PR gdb/26199 * infrun.c (handle_no_resumed): Transfer terminal to inferior with executing threads.
2020-07-06Fix handle_no_resumed w/ multiple targetsPedro Alves1-5/+17
handle_no_resumed is currently not considering multiple targets. Say you have two inferiors 1 and 2, each connected to a different target, A and B. Now say you set inferior 2 running, with "continue &". Now you select a thread of inferior 1, say thread 1.2, and continue in the foreground. All other threads of inferior 1 are left stopped. Thread 1.2 exits, and thus target A has no other resumed thread, so it reports TARGET_WAITKIND_NO_RESUMED. At this point, if both inferiors were running in the same target, handle_no_resumed would realize that threads of inferior 2 are still executing, so the TARGET_WAITKIND_NO_RESUMED event should be ignored. But because handle_no_resumed only walks the threads of the current target, it misses noticing that threads of inferior 2 are still executing. The fix is just to walk over all threads of all targets. A testcase covering the use case above will be added in a following patch. It can't be added yet because it depends on yet another fix to handle_no_resumed not included here. gdb/ChangeLog: PR gdb/26199 * infrun.c (handle_no_resumed): Handle multiple targets.
2020-07-06Avoid constant stream of TARGET_WAITKIND_NO_RESUMEDPedro Alves1-1/+5
If we hit the synchronous execution command case described by handle_no_resumed, and handle_no_resumed determines that the event should be ignored, because it found a thread that is executing, we end up in prepare_to_wait. There, if the current target is not registered in the event loop right now, we call mark_infrun_async_event_handler. With that event handler marked, the event loop calls again into fetch_inferior_event, which calls target_wait, which returns TARGET_WAITKIND_NO_RESUMED, and we end up in handle_no_resumed, again ignoring the event and marking infrun_async_event_handler. The result is that GDB is now always keeping the CPU 100% busy in this loop, even though it continues to be able to react to input and to real target events, because we still go through the event-loop. The problem is that marking of the infrun_async_event_handler in prepare_to_wait. That is there to handle targets that don't support asynchronous execution. So the correct predicate is whether async execution is supported, not whether the target is async right now. gdb/ChangeLog: PR gdb/26199 * infrun.c (prepare_to_wait): Check target_can_async_p instead of target_is_async_p.
2020-07-06Fix latent bug in target_pass_ctrlcPedro Alves1-1/+1
We were checking the thr->executing of an exited thread. gdb/ChangeLog: PR gdb/26199 * target.c (target_pass_ctrlc): Looking at the inferiors non-exited threads, not all threads.
2020-07-04Fix spurious unhandled remote %Stop notificationsPedro Alves1-1/+14
In non-stop mode, remote targets mark an async event source whose callback is supposed to result in calling remote_target::wait_ns to either process the event queue, or acknowledge an incoming %Stop notification. The callback in question is remote_async_inferior_event_handler, where we call inferior_event_handler, to end up in fetch_inferior_event -> target_wait -> remote_target::wait -> remote_target::wait_ns. A problem here however is that when debugging multiple targets, fetch_inferior_event can pull events out of any target picked at random, for event fairness. This means that when remote_async_inferior_event_handler returns, remote_target::wait may have not been called at all, and thus pending notifications may have not been acked. Because async event sources auto-clear, when remote_async_inferior_event_handler returns the async event handler is no longer marked, so the event loop won't automatically call remote_async_inferior_event_handler again to try to process the pending remote notifications/queue. The result is that stop events may end up not processed, e.g., "interrupt -a" seemingly not managing to stop all threads. Fix this by making remote_async_inferior_event_handler mark the event handler again before returning, if necessary. Maybe a better fix would be to make async event handlers not auto-clear themselves, make that the responsibility of the callback, so that the event loop would keep calling the callback automatically. Or, we could try making so that fetch_inferior_event would optionally handle events only for the target that it got passed down via parameter. However, I don't think now just before branching is the time to try to do any such change. gdb/ChangeLog: PR gdb/26199 * remote.c (remote_target::open_1): Pass remote target pointer as data to create_async_event_handler. (remote_async_inferior_event_handler): Mark async event handler before returning if the remote target still has either pending events or unacknowledged notifications.
2020-07-03sim/ppc: Fix linker error with -fno-commonSebastian Huber3-17/+38
GCC 10 enables -fno-common by default. This resulted in a multiple definition linker error since global variables were declared and defined in a header file: ld: ld-insn.o:sim/ppc/ld-insn.h:221: multiple definition of `max_model_fields_len'; igen.o:sim/ppc/ld-insn.h:221: first defined here sim/ppc * ld-insn.h (last_model, last_model_data, last_model_function, last_model_internal, last_model_macro, last_model_static): Delete. (max_model_fields_len, model_data, model_functions, model_internal, model_macros, model_static, models): Declare, but do not define. * ld-insn.c (last_model, last_model_data, last_model_function, last_model_internal, last_model_macro, last_model_static, max_model_fields_len, model_data, model_functions, model_internal, model_macros, model_static, models): Define.
2020-07-03Fix gdb.base/structs2.exp with ClangPedro Alves3-2/+8
gdb.base/structs2.exp fails to run with Clang, because of: gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:14: warning: implicit conversion from 'int' to 'signed char' changes value from 130 to -126 [-Wconstant-conversion] param_reg (130, 120, 33000, 32000); ~~~~~~~~~ ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:24: warning: implicit conversion from 'int' to 'short' changes value from 33000 to -32536 [-Wconstant-conversion] param_reg (130, 120, 33000, 32000); ~~~~~~~~~ ^~~~~ 2 warnings generated. === gdb Summary === # of untested testcases 1 Fix it by passing actual negative numbers. gdb/testsuite/ChangeLog: * gdb.base/structs2.c (main): Adjust second parem_reg call to explicitly write negative numbers. * gdb.base/structs2.exp: Adjust expected output.
2020-07-03Fix gdb.base/charset.exp with ClangPedro Alves2-4/+18
gdb.base/charset.exp fails to run with Clang, because of: gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:144:20: warning: implicit conversion from 'int' to 'char' changes value from 162 to -94 [-Wconstant-conversion] 11, 162, 17); ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:151:16: warning: implicit conversion from 'int' to 'char' changes value from 167 to -89 [-Wconstant-conversion] 167, ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:168:16: warning: implicit conversion from 'int' to 'char' changes value from 167 to -89 [-Wconstant-conversion] 167, ^~~ 3 warnings generated. === gdb Summary === # of untested testcases 1 Fix it by changing init_string to take unsigned char parameters. gdb/testsuite/ChangeLog: * gdb.base/charset.c (init_string): Change all char parameters to unsigned char parameters.
2020-07-03Remove stale -DNO_PROTOTYPES bits from gdb testsuitePedro Alves8-67/+27
The gdb.base/call-sc.exp, gdb.base/structs.exp and gdb.base/structs2.exp testcases still try compiling the sources with -DNO_PROTOTYPES, but the corresponding sources don't have any #ifdef NO_PROTOTYPES any longer. Those were removed throughout years ago. OTOH, gdb.base/ovlymgr.h does check for NO_PROTOTYPES, but no .exp file compiles it with -DNO_PROTOTYPES. gdb.base/reread.exp and gdb.base/varargs.exp set a 'prototypes' global, which is a stale bit left behind when the "try-compiling without and then with -DNO_PROTOTYPES" logic was around. gdb/testsuite/ChangeLog: * gdb.base/call-sc.exp (start_scalars_test): Use prepare_for_testing and don't try compiling with -DNO_PROTOTYPES. * gdb.base/overlays.c: Remove references to PARAMS. * gdb.base/ovlymgr.h (PARAMS): Delete, and remove all references. * gdb.base/reread.exp: Don't set 'prototypes' global. * gdb.base/structs.exp (start_structs_test): Use prepare_for_testing and don't try compiling with -DNO_PROTOTYPES. * gdb.base/structs2.exp: Don't set 'prototypes' global. Use prepare_for_testing and don't try compiling with -DNO_PROTOTYPES. Don't issue "set width 0". Remove gdb_stop_suppressing_tests call. * gdb.base/varargs.exp: Don't set 'prototypes' global.
2020-07-03Remove stale overlay testcase bitsPedro Alves4-583/+5
D10V support was removed years ago, but the gdb.base/d10vovly.c file stayed behind. Looking a bit closer, I can't find anywhere that references gdb.base/m32rovly.c either. Both gdb.base/m32rovly.c and gdb.base/d10vovly.c seem to be older copies of gdb.base/ovlymgr.c, that are exactly the same, except for some cosmetic differences, and for missing _ovly_debug_event. Note that gdb.base/ovlymgr.c has the #ifdef __M32R__ bits too. Note also that gdb.base/overlays.exp is currently only supported on m32r, and that uses ovlymgr.c not gdb.base/m32rovly.c. gdb/testsuite/ChangeLog: * gdb.base/d10vovly.c: Delete. * gdb.base/m32rovly.c: Delete. * gdb.base/ovlymgr.c: Remove all code guarded by __D10V__.
2020-07-03Re: Change readelf's display of symbol namesAlan Modra14-63/+88
Fixes some fallout from git commit 0942c7ab94e5. PR 26028 gas/ * testsuite/gas/ia64/unwind-ilp32.d: Add -T to readelf options. gold/ * testsuite/Makefile.am (file_in_many_sections.stdout): Add -W to readelf options. * testsuite/Makefile.in: Regenerate. ld/ * testsuite/ld-arm/arm-elf.exp (vxworks1): Pass --wide to readelf when dumping relocs. * testsuite/ld-i386/i386.exp (vxworks1): Likewise. * testsuite/ld-sh/sh-vxworks.exp (vxworks1): Likewise. * testsuite/ld-sparc/sparc.exp (vxworks1): Likewise. * testsuite/ld-arm/vxworks1.rd: Adjust to suit. * testsuite/ld-i386/vxworks1.rd: Adjust. * testsuite/ld-sh/vxworks1.rd: Adjust. * testsuite/ld-sparc/vxworks1.rd: Adjust.
2020-07-03Automatic date update in version.inGDB Administrator1-1/+1
2020-07-02x86: Add SwapSourcesH.J. Lu7-3991/+4008
We check register-only source operand to decide if two source operands of VEX encoded instructions should be swapped. But source operands in AMX instructions with two source operands swapped are all register-only operand. Add SwapSources to indicate two source operands should be swapped. gas/ * config/tc-i386.c (build_modrm_byte): Check vexswapsources to swap two source operands. opcodes/ * i386-gen.c (opcode_modifiers): Add VexSwapSources. * i386-opc.h (VexSwapSources): New. (i386_opcode_modifier): Add vexswapsources. * i386-opc.tbl: Add VexSwapSources to BMI2 and BMI instructions with two source operands swapped. * i386-tbl.h: Regenerated.
2020-07-02Skip fill-1 gas test for MeP targets.Nick Clifton2-1/+7
* testsuite/gas/all/fill-1.d: Skip for MeP targets.
2020-07-02aarch64: Fix segfault on unicode symbolsAlex Coplan4-1/+18
This patch fixes a segfault which occurs when the AArch64 backend parses a symbol operand that begins with a register name and ends with a unicode byte (byte value > 127). For example, the following input causes the crash: x0é: udf x0é gas/ChangeLog: 2020-07-02 Alex Coplan <alex.coplan@arm.com> * config/tc-aarch64.c (reg_name_p): Fix cast so that we don't segfault on negative chars. * testsuite/gas/aarch64/reglike-label-unicode-segv.d: New test. * testsuite/gas/aarch64/reglike-label-unicode-segv.s: Input.
2020-07-02gdb: remove unused fetch_inferior_event and inferior_event_handler parametersSimon Marchi10-18/+31
I noticed that fetch_inferior_event receives the client_data parameter from its caller, inferior_event_handler, but doesn't actually need it. This patch removes it. In turn, inferior_event_handler doesn't use its parameter, so remove it too. The `data` argument used when registering remote_async_inferior_event_handler is changed to NULL, to avoid confusion. It could make people think that the value passed is used somewhere, when in fact it's not. gdb/ChangeLog: * inf-loop.c (inferior_event_handler): Remove client_data param. * inf-loop.h (inferior_event_handler): Likewise. * infcmd.c (step_1): Adjust. * infrun.c (proceed): Adjust. (fetch_inferior_event): Remove client_data param. (infrun_async_inferior_event_handler): Adjust. * infrun.h (fetch_inferior_event): Remove `void *` param. * linux-nat.c (handle_target_event): Adjust. * record-btrace.c (record_btrace_handle_async_inferior_event): Adjust. * record-full.c (record_full_async_inferior_event_handler): Adjust. * remote.c (remote_async_inferior_event_handler): Adjust. Change-Id: I3c2aa1eb0ea3e0985df096660d2dcd794674f2ea
2020-07-02Change readelf's display of symbol names (when not in --wide mode) so that ↵Nick Clifton19-25/+116
if they are going to be truncated then "[...]" is displayed at the end. Add a comment line option to disable this enhancement and restore the old behaviour. PR 26028 binutils* readelf.c (print_symbol): Handle truncation of symbol names. (options): Add -T/--silent-truncation option. (parse_args): Handle the option. (print_dynamic_symbol): Correct calculation of width available to display symbol name. * doc/binutils.texi: Document the -T option to readelf. * NEWS: Mention the new feature. gas * testsuite/gas/ia64/group-2.d: Add -T option to readelf command line. * testsuite/gas/ia64/unwind.d: Likewise. * testsuite/gas/mmix/bspec-1.d: Likewise. * testsuite/gas/mmix/bspec-2.d: Likewise. * testsuite/gas/mmix/comment-1.d: Likewise. * testsuite/gas/tic6x/scomm-directive-4.d: Likewise. ld * testsuite/ld-powerpc/powerpc.exp: Add -T option to readelf command line when running some tests. * testsuite/ld-arm/arm-elf.exp: Likewise. * testsuite/ld-mips-elf/mips-elf.exp: Likewise. * testsuite/ld-mmix/local1.d: Likewise. * testsuite/ld-mmix/local3.d: Likewise. * testsuite/ld-mmix/local5.d: Likewise. * testsuite/ld-mmix/local7.d: Likewise. * testsuite/ld-powerpc/powerpc.exp: Likewise.
2020-07-01Make tui_win_info::name pure virtualTom Tromey3-4/+11
It seemed cleaner to me for tui_win_info::name to be pure virtual. This meant adding a name method to the locator window; but this too seems like an improvement. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_win_info) <name>: Now pure virtual. * tui/tui-stack.h (struct tui_locator_window) <name>: New method.
2020-07-01Remove tui_gen_win_infoTom Tromey6-93/+76
This merges the tui_gen_win_info base class with tui_win_info; renaming the resulting class to tui_win_info. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_win_info::refresh_window): Move from tui_gen_win_info. (tui_win_info::make_window): Merge with tui_gen_win_info::make_window. (tui_win_info::make_visible): Move from tui_gen_win_info. * tui/tui-win.c (tui_win_info::max_width): Move from tui_gen_win_info. * tui/tui-layout.h (class tui_layout_window) <m_window>: Change type. <window_factory>: Likewise. * tui/tui-layout.c (tui_win_info::resize): Move from tui_gen_win_info. (make_standard_window): Change return type. (get_locator_window, tui_get_window_by_name): Likewise. (tui_layout_window::apply): Remove a cast. * tui/tui-data.h (MIN_WIN_HEIGHT): Move earlier. (struct tui_win_info): Merge with tui_gen_win_info. (struct tui_gen_win_info): Remove.
2020-07-01Derive tui_locator_window from tui_win_infoTom Tromey2-1/+23
tui_locator_window is the last remaining concrete child class of tui_gen_win_info. It seems a bit cleaner to me to flatten the hierarchy a bit; this patch prepares for that by changing tui_locator_window to derive from tui_win_info. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window): Derive from tui_win_info. <do_scroll_horizontal, do_scroll_vertical>: New methods. <can_box>: New method.
2020-07-01Remove body of tui_locator_window constructorTom Tromey2-5/+5
The tui_locator_window constructor initializes the first character of two of its members. However, this is actually an error, since these were changed to be std::string. This removes the erroneous code. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window): Remove body.
2020-07-01Don't derive tui_data_item_window from tui_gen_win_infoTom Tromey4-78/+51
There's no deep reason that tui_data_item_window should derive from tui_gen_win_info -- it currently uses a curses window to render, but that isn't truly needed, and it adds some hacks to other parts of the TUI. This patch changes tui_data_item_window so that it doesn't have a base class, and updates the register window. This simplifies the code and enables a subsequent cleanup. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::display_registers_from) (tui_data_window::display_registers_from) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows): Update. (tui_data_window::refresh_window, tui_data_window::no_refresh): Remove. (tui_data_window::check_register_values): Update. (tui_data_item_window::rerender): Add parameters. Update. (tui_data_item_window::refresh_window): Remove. * tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: No longer virtual. * tui/tui-regs.h (struct tui_data_item_window): Don't derive from tui_gen_win_info. <refresh_window, max_height, min_height>: Remove. <rerender>: Add parameters. <x, y, visible>: New members. (struct tui_data_window) <refresh_window, no_refresh>: Remove. <m_item_width>: New member.
2020-07-01Rename tui_data_item_window::item_noTom Tromey3-4/+11
tui_data_item_window::item_no is misnamed -- it only can be used for a register, but it references a "display" number as well. (Based on other comments I've seen in the past -- most since deleted -- I think there were plans at one point to display variables in this window as well. However, this was never implemented.) This patch renames this member to be more correct. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group) (tui_data_window::check_register_values): Update. * tui/tui-regs.h (struct tui_data_item_window) <regno>: Rename from item_no.
2020-07-01Remove useless "if' from tui-regs.cTom Tromey2-7/+9
tui_data_window::show_register_group had a useless "if" -- the condition could never be false. This patch removes it. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group): Remove useless "if".
2020-07-01Remove tui_data_window::nameTom Tromey3-2/+5
The "name" member of tui_data_window was set, but never used. This removes it. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group): Update. * tui/tui-regs.h (struct tui_data_item_window) <name>: Remove.
2020-07-01Move some code out of tui-data.hTom Tromey5-26/+35
This moves some code out of tui-data.h, to more closely related places. Some unused forward declarations are also removed. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (SINGLE_KEY): Move from tui-data.h * tui/tui-winsource.h (enum tui_line_or_address_kind) (struct tui_line_or_address): Move from tui-data.h. * tui/tui-win.c (DEFAULT_TAB_LEN): Move from tui-data.h. * tui/tui-data.h (DEFAULT_TAB_LEN): Move to tui-win.c. (tui_cmd_window, tui_source_window_base, tui_source_window) (tui_disasm_window): Don't declare. (enum tui_line_or_address_kind, struct tui_line_or_address): Move to tui-winsource.h. (SINGLE_KEY): Move to tui-stack.c.
2020-07-01Remove tui_expand_tabsTom Tromey5-73/+61
tui_expand_tabs only has a single caller. This patch removes this function, in favor of a tab-expanding variant of string_file. This simplifies the code somewhat. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <content>: Now a std::string. * tui/tui-regs.c (class tab_expansion_file): New. (tab_expansion_file::write): New method. (tui_register_format): Change return type. Use tab_expansion_file. (tui_get_register, tui_data_window::display_registers_from) (tui_data_item_window::rerender): Update. * tui/tui-io.h (tui_expand_tabs): Don't declare. * tui/tui-io.c (tui_expand_tabs): Remove.
2020-07-01Use complete_on_enum in tui_reggroup_completerTom Tromey2-9/+6
tui_reggroup_completer has an "XXXX" comment suggesting the use of complete_on_enum. This patch implements this suggestion. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum.
2020-07-02Automatic date update in version.inGDB Administrator1-1/+1
2020-07-01Recognize -1 as a tombstone value in .debug_lineFangrui Song2-6/+11
LLD from 11 onwards (https://reviews.llvm.org/D81784) uses -1 to represent a relocation in .debug_line referencing a discarded symbol. Recognize -1 to fix gdb.base/break-on-linker-gcd-function.exp when the linker is a newer LLD. gdb/ChangeLog: * dwarf2/read.c (lnp_state_machine::check_line_address): Test -1.
2020-07-01PR26188, buff overflow in coff_find_nearest_line_with_namesAlan Modra2-2/+12
PR 26188 * coffgen.c (coff_find_nearest_line_with_names): Sanity check raw syment index before dereferencing.
2020-07-01Allow reference form for DW_AT_associated and DW_AT_allocated attributesAlok Kumar Sharma2-14/+8
Currently, GDB rejects the (die) reference form while it accepts exprloc form. It is allowed in DWARF standard. "Table 7.5: Attribute encodings" in DWARF5 standard. Flang compiler assigns (die) reference to DW_AT_associated and DW_AT_allocated for some cases. gdb/ChangeLog * dwarf2/read.c (set_die_type): Removed conditions to restrict forms for DW_AT_associated and DW_AT_allocated attributes, which is already checked in function attr_to_dynamic_prop.
2020-07-01Re: Remove x86 NaCl target supportAlan Modra2-0/+5
Fixes accidental breakage of vxworks by commit bbd19b19e4. * elf32-i386.c (elf_backend_object_p): Undef for vxworks.
2020-07-01obsolete xc16xAlan Modra4-0/+11
The xc16x md_apply_fix code is just so broken that in my opinion the target should never have been accepted, and from a quick look at commit logs for the target it appears that no one has ever contributed fixes for anything. This target has just been a 14 year burden on global binutils and cgen maintainers. That's not how free software is supposed to work. bfd/ * config.bfd: Obsolete xc16x. gas/ * config/tc-xc16x.c (md_apply_fix): Add FIXME.
2020-07-01gas eqv-dot test failsAlan Modra2-1/+9
* testsuite/gas/all/eqv-dot.d: xfail targets that set linkrelax in data sections, and mep.
2020-07-01Automatic date update in version.inGDB Administrator1-1/+1
2020-06-30Update readline/README to mention patchlevelTom Tromey2-0/+8
This updates readline/README to mention the current patchlevel, and the "git am" approach to importing new upstream patches. readline/ChangeLog 2020-06-30 Tom Tromey <tom@tromey.com> * README: Update instructions.
2020-06-30problems restoring the history file are not signaled correctly to the ↵Chet Ramey2-1/+3
calling application
2020-06-30reading history entries with timestamps can result in joined entriesChet Ramey2-2/+15
2020-06-30fix problems moving back beyond start of historyChet Ramey2-2/+5
2020-06-30Readline-8.0 patch 1: fix file descriptor leak with zero-length history fileChet Ramey2-1/+2
2020-06-30Fix test breakages caused by removal of gdb_py_test_multiple.Philippe Waroquiers10-39/+52
Tom de Vries detected that some python tests were broken as they were still using gdb_py_test_multiple that was replaced by gdb_test_multiline. Repair these tests by using the new function. gdb/testsuite/ChangeLog 2020-06-30 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.python/py-breakpoint.exp: use gdb_test_multiline instead of gdb_py_test_multiple. * gdb.python/py-cmd.exp: Likewise. * gdb.python/py-events.exp: Likewise. * gdb.python/py-function.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.python/py-infthread.exp: Likewise. * gdb.python/py-linetable.exp: Likewise. * gdb.python/py-parameter.exp: Likewise. * gdb.python/py-value.exp: Likewise.
2020-06-30Remove x86 NaCl target supportH.J. Lu222-4116/+383
NaCl has been deprecated: https://developer.chrome.com/native-client/migration and NaCl will completely disappear in 2021: https://lists.llvm.org/pipermail/llvm-dev/2020-April/141107.html Remove x86 NaCl target support from bfd, binutils, gas and ld. bfd/ * archures.c (bfd_mach_i386_nacl): Removed. (bfd_mach_i386_i386_nacl): Likewise. (bfd_mach_x86_64_nacl): Likewise. (bfd_mach_x64_32_nacl): Likewise. * config.bfd: Remove *-*-nacl* targets. * configure.ac: Remove x86 NaCl target vectors. * cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed. (bfd_x64_32_nacl_arch): Likewise. (bfd_x86_64_nacl_arch): Likewise. (bfd_i386_nacl_arch): Likewise. (bfd_x64_32_arch_intel_syntax): Updated. * elf32-i386.c: Don't include "elf-nacl.h". (elf_i386_nacl_plt): Removed. (elf_i386_nacl_plt0_entry): Likewise. (elf_i386_nacl_plt_entry): Likewise. (elf_i386_nacl_pic_plt0_entry): Likewise. (elf_i386_nacl_pic_plt_entry): Likewise. (elf_i386_nacl_eh_frame_plt): Likewise. (elf_i386_nacl_plt): Likewise. (elf32_i386_nacl_elf_object_p): Likewise. (elf_i386_get_synthetic_symtab): Updated. (elf_i386_link_setup_gnu_properties): Likewise. * elf64-x86-64.c: Don't include "elf-nacl.h". (elf_x86_64_nacl_plt): Removed. (elf64_x86_64_nacl_elf_object_p): Likewise. (elf_x86_64_nacl_plt0_entry): Likewise. (elf_x86_64_nacl_plt_entry): Likewise. (elf_x86_64_nacl_eh_frame_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf32_x86_64_nacl_elf_object_p): Likewise. (elf_x86_64_get_synthetic_symtab): Updated. (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise. * targets.c: Remove x86 NaCl target vectors. * bfd-in2.h: Regenerated. * configure: Likewise. binutils/ * NEWS: Mention x86 NaCl target support removal. * dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): Remove x86 NaCl target support. * testsuite/binutils-all/elfedit-1.d: Likewise. * testsuite/binutils-all/i386/i386.exp: Likewise. * testsuite/binutils-all/x86-64/objects.exp: Likewise. * testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494a.d: Likewise. * testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494b.d: Likewise. * testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494c.d: Likewise. * testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494d.d: Likewise. * testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494e.d: Likewise. * testsuite/binutils-all/x86-64/x86-64.exp: Likewise. gas/ * NEWS: Mention x86 NaCl target support removal. * config/tc-i386.c: Remove x86 NaCl target support. * config/tc-i386.h: Likewise. * configure.tgt: Likewise. * testsuite/gas/i386/i386.exp: Likewise. * testsuite/gas/i386/iamcu-1.d: Likewise. * testsuite/gas/i386/iamcu-2.d: Likewise. * testsuite/gas/i386/iamcu-3.d: Likewise. * testsuite/gas/i386/iamcu-4.d: Likewise. * testsuite/gas/i386/iamcu-5.d: Likewise. * testsuite/gas/i386/k1om.d: Likewise. * testsuite/gas/i386/l1om.d: Likewise. ld/ * Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_nacl.c, eelf32_x86_64_nacl.c, eelf_x86_64_nacl.c. Remove x86 NaCl dep files. * NEWS: Mention x86 NaCl target support removal. * configure.tgt: Remove x86 NaCl target support. * testsuite/ld-elf/binutils.exp: Likewise. * testsuite/ld-elf/elf.exp: Likewise. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-i386/align-branch-1.d: Likewise. * testsuite/ld-i386/export-class.exp: Likewise. * testsuite/ld-i386/i386.exp: Likewise. * testsuite/ld-i386/load1.d: Likewise. * testsuite/ld-i386/pie1.d: Likewise. * testsuite/ld-i386/pr12570a.d: Likewise. * testsuite/ld-i386/pr12570b.d: Likewise. * testsuite/ld-i386/pr19636-1d.d: Likewise. * testsuite/ld-i386/pr19636-1l.d: Likewise. * testsuite/ld-i386/pr19636-2c.d: Likewise. * testsuite/ld-i386/pr19636-2d.d: Likewise. * testsuite/ld-i386/pr19636-2e.d: Likewise. * testsuite/ld-i386/pr20244-1a.d: Likewise. * testsuite/ld-i386/pr20244-1b.d: Likewise. * testsuite/ld-i386/pr20244-2a.d: Likewise. * testsuite/ld-i386/pr20244-2b.d: Likewise. * testsuite/ld-i386/pr20244-2c.d: Likewise. * testsuite/ld-i386/pr20244-4a.d: Likewise. * testsuite/ld-i386/pr20244-4b.d: Likewise. * testsuite/ld-i386/pr21884.d: Likewise. * testsuite/ld-ifunc/binutils.exp: Likewise. * testsuite/ld-ifunc/ifunc-10-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-11-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-12-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-13-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-15-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-16-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-20-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-21-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-22-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-8-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-9-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise. * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. * testsuite/ld-ifunc/pr17154-i386.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-x86-64/align-branch-1.d: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Likewise. * testsuite/ld-x86-64/line.exp: Likewise. * testsuite/ld-x86-64/load1a.d: Likewise. * testsuite/ld-x86-64/load1b.d: Likewise. * testsuite/ld-x86-64/load1c.d: Likewise. * testsuite/ld-x86-64/load1d.d: Likewise. * testsuite/ld-x86-64/pie3.d: Likewise. * testsuite/ld-x86-64/pr18160.d: Likewise. * testsuite/ld-x86-64/pr19013-x32.d: Likewise. * testsuite/ld-x86-64/pr19013.d: Likewise. * testsuite/ld-x86-64/pr19636-2d.d: Likewise. * testsuite/ld-x86-64/pr19636-2l.d: Likewise. * testsuite/ld-x86-64/pr20253-1b.d: Likewise. * testsuite/ld-x86-64/pr20253-1d.d: Likewise. * testsuite/ld-x86-64/pr20253-1f.d: Likewise. * testsuite/ld-x86-64/pr20253-1h.d: Likewise. * testsuite/ld-x86-64/pr20253-1j.d: Likewise. * testsuite/ld-x86-64/pr20253-1l.d: Likewise. * testsuite/ld-x86-64/pr21884.d: Likewise. * testsuite/ld-x86-64/pr22393-3a.rd: Likewise. * testsuite/ld-x86-64/pr22393-3b.rd: Likewise. * testsuite/ld-x86-64/tlsgd10.dd: Likewise. * testsuite/ld-x86-64/tlsgd5.dd: Likewise. * testsuite/ld-x86-64/tlsgd8.dd: Likewise. * testsuite/ld-x86-64/x86-64.exp: Likewise. * emulparams/elf32_x86_64_nacl.sh: Removed. * emulparams/elf_i386_nacl.sh: Likewise. * emulparams/elf_x86_64_nacl.sh: Likewise. * testsuite/ld-i386/emit-relocs-nacl.rd: Likewise. * testsuite/ld-i386/load1-nacl.d: Likewise. * testsuite/ld-i386/pie1-nacl.d: Likewise. * testsuite/ld-i386/plt-nacl.pd: Likewise. * testsuite/ld-i386/plt-pic-nacl.pd: Likewise. * testsuite/ld-i386/pr17709-nacl.rd: Likewise. * testsuite/ld-i386/pr19636-1d-nacl.d: Likewise. * testsuite/ld-i386/pr19636-2c-nacl.d: Likewise. * testsuite/ld-i386/pr19636-2d-nacl.d: Likewise. * testsuite/ld-i386/pr19636-2e-nacl.d: Likewise. * testsuite/ld-i386/pr19827-nacl.rd: Likewise. * testsuite/ld-i386/pr21884-nacl.d: Likewise. * testsuite/ld-i386/pr21884-nacl.t: Likewise. * testsuite/ld-i386/tlsbin-nacl.rd: Likewise. * testsuite/ld-i386/tlsbin2-nacl.rd: Likewise. * testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise. * testsuite/ld-i386/tlsdesc-nacl.rd: Likewise. * testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise. * testsuite/ld-i386/tlsnopic-nacl.rd: Likewise. * testsuite/ld-i386/tlspic-nacl.rd: Likewise. * testsuite/ld-i386/tlspic2-nacl.rd: Likewise. * testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise. * testsuite/ld-x86-64/load1a-nacl.d: Likewise. * testsuite/ld-x86-64/load1b-nacl.d: Likewise. * testsuite/ld-x86-64/load1c-nacl.d: Likewise. * testsuite/ld-x86-64/load1d-nacl.d: Likewise. * testsuite/ld-x86-64/pie3-nacl.d: Likewise. * testsuite/ld-x86-64/plt-nacl.pd: Likewise. * testsuite/ld-x86-64/pr17709-nacl.rd: Likewise. * testsuite/ld-x86-64/pr19013-nacl.d: Likewise. * testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise. * testsuite/ld-x86-64/pr19827-nacl.rd: Likewise. * testsuite/ld-x86-64/pr21884-nacl.d: Likewise. * testsuite/ld-x86-64/pr21884-nacl.t: Likewise. * testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise. * testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise. * testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise. * testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise. * testsuite/ld-x86-64/tlsdesc-nacl.pd: Likewise. * testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise. * testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise. * testsuite/ld-x86-64/tlspic-nacl.rd: Likewise. * testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise. * Makefile.in: Regenerated. * po/BLD-POTFILES.in: Likewise.
2020-06-30Fix bug in quirk_rust_enumTom Tromey2-1/+6
Tom de Vries pointed out that some Rust tests were failing after the variant part rewrite. He sent an executable, which helped track down this bug. quirk_rust_enum was passing 1 to alloc_rust_variant in one case. However, a comment earlier says: /* We don't need a range entry for the discriminant, but we do need one for every other field, as there is no default variant. */ In this case, we must pass -1 for this parameter. That is what this patch implements. gdb/ChangeLog 2020-06-30 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (quirk_rust_enum): Correctly call alloc_rust_variant for default-less enum.
2020-06-30Do not define basic_string_view::to_stringTom Tromey4-11/+26
gdb's copy of basic_string_view includes a to_string method. However, according to cppreference, this is not a method on the real std::basic_string_view: https://en.cppreference.com/w/cpp/string/basic_string_view This difference matters because gdb_string_view.h will use the standard implementation when built with a C++17 or later. This caused PR build/26183. This patch fixes the problem by changing the method to be a standalone helper function, and then rewriting the uses. Tested by rebuilding with a version of GCC that defaults to C++17. (Note that the build still is not clean; and also I noticed that the libstdc++ string_view forbids the use of nullptr ... I wonder if gdb violates that.) gdb/ChangeLog 2020-06-30 Tom Tromey <tromey@adacore.com> PR build/26183: * ada-lang.c (ada_lookup_name_info::ada_lookup_name_info): Use gdb::to_string. gdbsupport/ChangeLog 2020-06-30 Tom Tromey <tromey@adacore.com> PR build/26183: * gdb_string_view.h (basic_string_view::to_string): Remove. (gdb::to_string): New function.