old-cross-binutils/gdb/testsuite/gdb.threads
Pedro Alves a25a5a45ef Fix "breakpoint always-inserted off"; remove "breakpoint always-inserted auto"
By default, GDB removes all breakpoints from the target when the
target stops and the prompt is given back to the user.  This is useful
in case GDB crashes while the user is interacting, as otherwise,
there's a higher chance breakpoints would be left planted on the
target.

But, as long as any thread is running free, we need to make sure to
keep breakpoints inserted, lest a thread misses a breakpoint.  With
that in mind, in preparation for non-stop mode, we added a "breakpoint
always-inserted on" mode.  This traded off the extra crash protection
for never having threads miss breakpoints, and in addition is more
efficient if there's a ton of breakpoints to remove/insert at each
user command (e.g., at each "step").

When we added non-stop mode, and for a period, we required users to
manually set "always-inserted on" when they enabled non-stop mode, as
otherwise GDB removes all breakpoints from the target as soon as any
thread stops, which means the other threads still running will miss
breakpoints.  The test added by this patch exercises this.

That soon revealed a nuisance, and so later we added an extra
"breakpoint always-inserted auto" mode, that made GDB behave like
"always-inserted on" when non-stop was enabled, and "always-inserted
off" when non-stop was disabled.  "auto" was made the default at the
same time.

In hindsight, this "auto" setting was unnecessary, and not the ideal
solution.  Non-stop mode does depends on breakpoints always-inserted
mode, but only as long as any thread is running.  If no thread is
running, no breakpoint can be missed.  The same is true for all-stop
too.  E.g., if, in all-stop mode, and the user does:

 (gdb) c&
 (gdb) b foo

That breakpoint at "foo" should be inserted immediately, but it
currently isn't -- currently it'll end up inserted only if the target
happens to trip on some event, and is re-resumed, e.g., an internal
breakpoint triggers that doesn't cause a user-visible stop, and so we
end up in keep_going calling insert_breakpoints.  The test added by
this patch also covers this.

IOW, no matter whether in non-stop or all-stop, if the target fully
stops, we can remove breakpoints.  And no matter whether in all-stop
or non-stop, if any thread is running in the target, then we need
breakpoints to be immediately inserted.  And then, if the target has
global breakpoints, we need to keep breakpoints even when the target
is stopped.

So with that in mind, and aiming at reducing all-stop vs non-stop
differences for all-stop-on-stop-of-non-stop, this patch fixes
"breakpoint always-inserted off" to not remove breakpoints from the
target until it fully stops, and then removes the "auto" setting as
unnecessary.  I propose removing it straight away rather than keeping
it as an alias, unless someone complains they have scripts that need
it and that can't adjust.

Tested on x86_64 Fedora 20.

gdb/
2014-09-22  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention merge of "breakpoint always-inserted" modes "off"
	and "auto" merged.
	* breakpoint.c (enum ugll_insert_mode): New enum.
	(always_inserted_mode): Now a plain boolean.
	(show_always_inserted_mode): No longer handle AUTO_BOOLEAN_AUTO.
	(breakpoints_always_inserted_mode): Delete.
	(breakpoints_should_be_inserted_now): New function.
	(insert_breakpoints): Pass UGLL_INSERT to
	update_global_location_list instead of calling
	insert_breakpoint_locations manually.
	(create_solib_event_breakpoint_1): New, factored out from ...
	(create_solib_event_breakpoint): ... this.
	(create_and_insert_solib_event_breakpoint): Use
	create_solib_event_breakpoint_1 instead of calling
	insert_breakpoint_locations manually.
	(update_global_location_list): Change parameter type from boolean
	to enum ugll_insert_mode.  All callers adjusted.  Adjust to use
	breakpoints_should_be_inserted_now and handle UGLL_INSERT.
	(update_global_location_list_nothrow): Change parameter type from
	boolean to enum ugll_insert_mode.
	(_initialize_breakpoint): "breakpoint always-inserted" option is
	now a boolean command.  Update help text.
	* breakpoint.h (breakpoints_always_inserted_mode): Delete declaration.
	(breakpoints_should_be_inserted_now): New declaration.
	* infrun.c (handle_inferior_event) <TARGET_WAITKIND_LOADED>:
	Remove breakpoints_always_inserted_mode check.
	(normal_stop): Adjust to use breakpoints_should_be_inserted_now.
	* remote.c (remote_start_remote): Likewise.

gdb/doc/
2014-09-22  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Set Breaks): Document that "set breakpoint
	always-inserted off" is the default mode now.  Delete
	documentation of "set breakpoint always-inserted auto".

gdb/testsuite/
2014-09-22  Pedro Alves  <palves@redhat.com>

	* gdb.threads/break-while-running.exp: New file.
	* gdb.threads/break-while-running.c: New file.
2014-09-22 10:07:04 +01:00
..
attach-into-signal.c
attach-into-signal.exp
attach-stopped.c
attach-stopped.exp
bp_in_thread.c
bp_in_thread.exp
break-while-running.c Fix "breakpoint always-inserted off"; remove "breakpoint always-inserted auto" 2014-09-22 10:07:04 +01:00
break-while-running.exp Fix "breakpoint always-inserted off"; remove "breakpoint always-inserted auto" 2014-09-22 10:07:04 +01:00
clone-new-thread-event.c
clone-new-thread-event.exp
corethreads.c
corethreads.exp
create-fail.c
create-fail.exp
current-lwp-dead.c
current-lwp-dead.exp
dlopen-libpthread-lib.c
dlopen-libpthread.c
dlopen-libpthread.exp
execl.c
execl.exp
execl1.c
fork-child-threads.c
fork-child-threads.exp
fork-thread-pending.c
fork-thread-pending.exp
gcore-stale-thread.c Fix 'gcore' with exited threads 2014-08-21 20:36:20 +02:00
gcore-stale-thread.exp Fix 'gcore' with exited threads 2014-08-21 20:36:20 +02:00
gcore-thread.exp Remove useless gcore command detection 2014-08-21 11:36:59 +01:00
hand-call-in-threads.c
hand-call-in-threads.exp
ia64-sigill.c
ia64-sigill.exp
info-threads-cur-sal-2.c
info-threads-cur-sal.c
info-threads-cur-sal.exp
interrupted-hand-call.c
interrupted-hand-call.exp
kill.c GDBserver crashes when killing a multi-thread process 2014-07-11 11:07:13 +01:00
kill.exp GDBserver crashes when killing a multi-thread process 2014-07-11 11:07:13 +01:00
killed.c
killed.exp after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test 2014-09-12 22:16:31 +01:00
leader-exit.c
leader-exit.exp
linux-dp.c
linux-dp.exp
local-watch-wrong-thread.c
local-watch-wrong-thread.exp
Makefile.in
manythreads.c
manythreads.exp
multi-create.c
multi-create.exp
multiple-step-overs.c Handle multiple step-overs. 2014-03-20 13:43:28 +00:00
multiple-step-overs.exp Handle multiple step-overs. 2014-03-20 13:43:28 +00:00
no-unwaited-for-left.c
no-unwaited-for-left.exp
non-ldr-exc-1.c
non-ldr-exc-1.exp
non-ldr-exc-2.c
non-ldr-exc-2.exp
non-ldr-exc-3.c
non-ldr-exc-3.exp
non-ldr-exc-4.c
non-ldr-exc-4.exp
pending-step.c
pending-step.exp
print-threads.c
print-threads.exp
pthread_cond_wait.c
pthread_cond_wait.exp
pthreads.c
pthreads.exp
queue-signal.c Fix set up of queue-signal.exp test. 2014-09-14 10:48:38 -07:00
queue-signal.exp New command queue-signal. 2014-09-13 21:44:00 -07:00
reconnect-signal.c
reconnect-signal.exp
schedlock.c
schedlock.exp
siginfo-threads.c
siginfo-threads.exp
signal-command-handle-nopass.c Always pass signals to the right thread 2014-07-25 16:57:31 +01:00
signal-command-handle-nopass.exp gdb.threads/signal-command-handle-nopass.exp: Add comment 2014-07-30 12:19:30 +01:00
signal-command-multiple-signals-pending.c Always pass signals to the right thread 2014-07-25 16:57:31 +01:00
signal-command-multiple-signals-pending.exp Always pass signals to the right thread 2014-07-25 16:57:31 +01:00
signal-delivered-right-thread.c Always pass signals to the right thread 2014-07-25 16:57:31 +01:00
signal-delivered-right-thread.exp Always pass signals to the right thread 2014-07-25 16:57:31 +01:00
signal-while-stepping-over-bp-other-thread.c Further cleanup of signal-while-stepping-over-bp-other-thread.c. 2014-03-20 14:09:53 +00:00
signal-while-stepping-over-bp-other-thread.exp Make signal-while-stepping-over-bp-other-thread.exp run against remote targets too. 2014-03-20 13:44:32 +00:00
sigstep-threads.c
sigstep-threads.exp
sigthread.c
sigthread.exp
staticthreads.c Fix the race in gdb.threads/staticthreads.exp 2014-06-06 09:45:22 +08:00
staticthreads.exp Fix the race in gdb.threads/staticthreads.exp 2014-06-06 09:45:22 +08:00
step-over-lands-on-breakpoint.c Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid. 2014-03-20 13:26:31 +00:00
step-over-lands-on-breakpoint.exp Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid. 2014-03-20 13:26:31 +00:00
step-over-trips-on-watchpoint.c Fix for even more missed events; eliminate thread-hop code. 2014-03-20 13:42:23 +00:00
step-over-trips-on-watchpoint.exp Fix for even more missed events; eliminate thread-hop code. 2014-03-20 13:42:23 +00:00
stepi-random-signal.c
stepi-random-signal.exp
switch-threads.c
switch-threads.exp
thread-execl.c gdb.threads/thread-execl.exp: #include <stdio.h>. 2014-08-25 12:23:50 -07:00
thread-execl.exp Fix next over threaded execl with "set scheduler-locking step". 2014-06-19 11:59:03 +01:00
thread-find.exp
thread-specific-bp.c
thread-specific-bp.exp enable target async by default; separate MI and target notions of async 2014-05-29 14:38:02 +01:00
thread-specific.c
thread-specific.exp gdb.threads/thread-specific.exp: Fix uninitialized variable references 2014-03-21 23:51:16 +00:00
thread-unwindonsignal.exp
thread_check.c
thread_check.exp
thread_events.c
thread_events.exp
threadapply.c
threadapply.exp
threxit-hop-specific.c
threxit-hop-specific.exp
tls-main.c
tls-nodebug.c
tls-nodebug.exp
tls-shared.c
tls-shared.exp
tls-var-main.c
tls-var.c
tls-var.exp
tls.c
tls.exp
tls2.c
watchpoint-fork-child.c
watchpoint-fork-mt.c
watchpoint-fork-parent.c
watchpoint-fork-st.c
watchpoint-fork.exp
watchpoint-fork.h
watchthreads-reorder.c
watchthreads-reorder.exp
watchthreads.c
watchthreads.exp
watchthreads2.c
watchthreads2.exp
wp-replication.c
wp-replication.exp