This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.
gdb/ChangeLog:
Update copyright year range in all GDB files.
This finally makes background execution commands possible by default.
However, in order to do that, there's one last thing we need to do --
we need to separate the MI and target notions of "async". Unlike the
CLI, where the user explicitly requests foreground vs background
execution in the execution command itself (c vs c&), MI chose to treat
"set target-async" specially -- setting it changes the default
behavior of execution commands.
So, we can't simply "set target-async" default to on, as that would
affect MI frontends. Instead we have to make the setting MI-specific,
and teach MI about sync commands on top of an async target.
Because the "target" word in "set target-async" ends up as a potential
source of confusion, the patch adds a "set mi-async" option, and makes
"set target-async" a deprecated alias.
Rather than make the targets always async, this patch introduces a new
"maint set target-async" option so that the GDB developer can control
whether the target is async. This makes it simpler to debug issues
arising only in the synchronous mode; important because sync mode
seems unlikely to go away.
Unlike in previous revisions, "set target-async" does not affect this
new maint parameter. The rationale for this is that then one can
easily run the test suite in the "maint set target-async off" mode and
have tests that enable mi-async fail just like they fail on
non-async-capable targets. This emulation is exactly the point of the
maint option.
I had asked Tom in a previous iteration to split the actual change of
the target async default to a separate patch, but it turns out that
that is quite awkward in this version of the patch, because with MI
async and target async decoupled (unlike in previous versions), if we
don't flip the default at the same time, then just "set target-async
on" alone never actually manages to do anything. It's best to not
have that transitory state in the tree.
Given "set target-async on" now only has effect for MI, the patch goes
through the testsuite removing it from non-MI tests. MI tests are
adjusted to use the new and less confusing "mi-async" spelling.
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* NEWS: Mention "maint set target-async", "set mi-async", and that
background execution commands are now always available.
* target.h (target_async_permitted): Update comment.
* target.c (target_async_permitted, target_async_permitted_1):
Default to 1.
(set_target_async_command): Rename to ...
(maint_set_target_async_command): ... this.
(show_target_async_command): Rename to ...
(maint_show_target_async_command): ... this.
(_initialize_target): Adjust.
* infcmd.c (prepare_execution_command): Make extern.
* inferior.h (prepare_execution_command): Declare.
* infrun.c (set_observer_mode): Leave target async alone.
* mi/mi-interp.c (mi_interpreter_init): Install
mi_on_sync_execution_done as sync_execution_done observer.
(mi_on_sync_execution_done): New function.
(mi_execute_command_input_handler): Don't print the prompt if we
just started a synchronous command with an async target.
(mi_on_resume): Check sync_execution before printing prompt.
* mi/mi-main.h (mi_async_p): Declare.
* mi/mi-main.c: Include gdbcmd.h.
(mi_async_p): New function.
(mi_async, mi_async_1): New globals.
(set_mi_async_command, show_mi_async_command, mi_async): New
functions.
(exec_continue): Call prepare_execution_command.
(run_one_inferior, mi_cmd_exec_run, mi_cmd_list_target_features)
(mi_execute_async_cli_command): Use mi_async_p.
(_initialize_mi_main): Install "set mi-async". Make
"target-async" a deprecated alias.
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Non-Stop Mode): Remove "set target-async 1"
from example.
(Asynchronous and non-stop modes): Document '-gdb-set mi-async'.
Mention that target-async is now deprecated.
(Maintenance Commands): Document maint set/show target-async.
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.base/async-shell.exp: Don't enable target-async.
* gdb.base/async.exp
* gdb.base/corefile.exp (corefile_test_attach): Remove 'async'
parameter. Adjust.
(top level): Don't test with "target-async".
* gdb.base/dprintf-non-stop.exp: Don't enable target-async.
* gdb.base/gdb-sigterm.exp: Don't test with "target-async".
* gdb.base/inferior-died.exp: Don't enable target-async.
* gdb.base/interrupt-noterm.exp: Likewise.
* gdb.mi/mi-async.exp: Use "mi-async" instead of "target-async".
* gdb.mi/mi-nonstop-exit.exp: Likewise.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-ns-stale-regcache.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-watch-nonstop.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Adjust comment.
* gdb.python/py-evsignal.exp: Don't enable target-async.
* gdb.python/py-evthreads.exp: Likewise.
* gdb.python/py-prompt.exp: Likewise.
* gdb.reverse/break-precsave.exp: Don't test with "target-async".
* gdb.server/solib-list.exp: Don't enable target-async.
* gdb.threads/thread-specific-bp.exp: Likewise.
* lib/mi-support.exp: Adjust to use mi-async.
breakpoint table handling. This is a patch in five parts (all committed
here in one commit).
----- 1/5: parse_args
parse_args is a very useful utility function which allows you to do
getopt-y kinds of things in Tcl.
Example:
proc myproc {foo args} {
parse_args {{bar} {baz "abc"} {qux}}
# ...
}
myproc ABC -bar -baz DEF peanut butter
will define the following variables in myproc:
foo (=ABC), bar (=1), baz (=DEF), and qux (=0)
args will be the list {peanut butter}
----- 2/5: mi_build_kv_pairs
build_kv_pairs simply does what it says: given the input list
and an option join string, it combines list elements into kv-pairs
for MI handling. It knows how to handle tuples and other special
MI types.
Example:
mi_build_kv_pairs {a b c d e f g \[.*\]}
returns a=\"b\",c=\"d\",e=\"f\",g=\[.*\]
----- 3/5: mi_make_breakpoint
This function builds breakpoint regexps, such as
"bkpt={number=\".*\", [snip]}".
Note that ONLY the options given to mi_make_breakpoint/mi_create_breakpoint
will actually be tested. So if -number is omitted, the regexp will allow
anything [number=\".*\"]
Examples:
mi_make_breakpoint -number 3
mi_create_breakpoint "myfile.c:21" -file myfile.c -line 21
----- 4/5: mi_make_breakpoint_table
This function builds MI breakpoint table regexps.
Example:
set bps {}
lappend bps [mi_make_breakpoint -number 1 -func "main" \
-file ".*/myfile.c" -line 42
lappend bps [mi_make_breakpoint -number 2 -func "marker" \
-file ".*myfile.c" -line 21
gdb_test "-break-info" "\\^done,[mi_make_breakpoint_table $bps]" \
"breakpoint list"
----- 5/5: Update all callers
Self-explanatory
testsuite/ChangeLog
2014-04-23 Keith Seitz <keiths@redhat.com>
* lib/mi-support.exp (mi_list_breakpoints): Delete.
(mi_make_breakpoint_table): New procedure.
(mi_create_breakpoint): Use mi_make_breakpoint
and return the result.
(mi_make_breakpoint): New procedure.
(mi_build_kv_pairs): New procedure.
* gdb.mi/mi-break.exp: Remove unused globals,
update mi_create_breakpoint usage, and use mi_make_breakpoint_table.
All callers updated.
* gdb.mi/mi-dprintf.exp: Use variable to track command
number.
Update all callers of mi_create_breakpoint and use
mi_make_breakpoint_table.
Remove any unused global variables.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-reverse.exp: Likewise.
* gdb.mi/mi-simplerun.exp: Likewise.
* gdb.mi/mi-stepn.exp: Likewise.
* gdb.mi/mi-syn-frame.exp: Likewise.
* gdb.mi/mi-until.exp: Likewise.
* gdb.mi/mi-var-cp.exp: Likewise.
* gdb.mi/mi-var-display.exp: Likewise.
* gdb.mi/mi2-amd64-entry-value.exp: Likewise.
* gdb.mi/mi2-var-child.exp: Likewise.
* gdb.mi/mi-vla-c99.exp: Likewise.
* lib/mi-support.exp: Likewise.
From Ian Lance Taylor <iant@cygnus.com>:
* lib/gdb.exp (parse_args): New procedure.
* breakpoint.c (print_one_breakpoint_location): Add MI
field 'thread-groups' when printing a breakpoint.
(output_thread_groups): New function.
2013-01-21 Marc Khouzam <marc.khouzam@ericsson.com>
* gdb.texinfo (GDB/MI Breakpoint Commands): Document new
'thread-groups' field when printing a breakpoint in MI.
2013-01-21 Marc Khouzam <marc.khouzam@ericsson.com>
* gdb.mi/mi-break.exp: Expect new 'thread-groups' field.
* gdb.mi/mi-nsmoribund.exp: Expect new 'thread-groups' field.
Also handle 'thread' field.
* gdb.mi/mi-simplerun.exp: Expect new 'thread-groups' field.
* gdb.mi/mi-watch.exp: Ditto.
* lib/mi-support.exp: Ditto.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
standard_output_file.
* gdb.mi/gdb2549.exp: Use standard_testfile.
* gdb.mi/gdb669.exp: Use standard_testfile.
* gdb.mi/gdb701.exp: Use standard_testfile.
* gdb.mi/gdb792.exp: Use standard_testfile.
* gdb.mi/mi-async.exp: Use standard_testfile.
* gdb.mi/mi-basics.exp: Use standard_testfile.
* gdb.mi/mi-break.exp: Use standard_testfile.
* gdb.mi/mi-cli.exp: Use standard_testfile.
* gdb.mi/mi-console.exp: Use standard_testfile.
* gdb.mi/mi-disassemble.exp: Use standard_testfile.
* gdb.mi/mi-eval.exp: Use standard_testfile.
* gdb.mi/mi-file-transfer.exp: Use standard_testfile.
* gdb.mi/mi-file.exp: Use standard_testfile.
* gdb.mi/mi-inheritance-syntax-error.exp: Use standard_testfile.
* gdb.mi/mi-logging.exp: Use standard_testfile.
* gdb.mi/mi-nonstop-exit.exp: Use standard_testfile.
* gdb.mi/mi-nonstop.exp: Use standard_testfile.
* gdb.mi/mi-ns-stale-regcache.exp: Use standard_testfile.
* gdb.mi/mi-nsintrall.exp: Use standard_testfile.
* gdb.mi/mi-nsmoribund.exp: Use standard_testfile.
* gdb.mi/mi-nsthrexec.exp: Use standard_testfile.
* gdb.mi/mi-pending.exp: Use standard_testfile,
standard_output_file.
* gdb.mi/mi-pthreads.exp: Use standard_testfile.
* gdb.mi/mi-read-memory.exp: Use standard_testfile.
* gdb.mi/mi-regs.exp: Use standard_testfile.
* gdb.mi/mi-return.exp: Use standard_testfile.
* gdb.mi/mi-reverse.exp: Use standard_testfile.
* gdb.mi/mi-simplerun.exp: Use standard_testfile.
* gdb.mi/mi-solib.exp: Use standard_testfile,
standard_output_file.
* gdb.mi/mi-stack.exp: Use standard_testfile.
* gdb.mi/mi-stepi.exp: Use standard_testfile.
* gdb.mi/mi-stepn.exp: Use standard_testfile.
* gdb.mi/mi-syn-frame.exp: Use standard_testfile.
* gdb.mi/mi-until.exp: Use standard_testfile.
* gdb.mi/mi-var-block.exp: Use standard_testfile.
* gdb.mi/mi-var-child-f.exp: Use standard_testfile.
* gdb.mi/mi-var-child.exp: Use standard_testfile.
* gdb.mi/mi-var-cmd.exp: Use standard_testfile.
* gdb.mi/mi-var-cp.exp: Use standard_testfile.
* gdb.mi/mi-var-display.exp: Use standard_testfile.
* gdb.mi/mi-var-invalidate.exp: Use standard_testfile,
standard_output_file.
* gdb.mi/mi-var-rtti.exp: Use standard_testfile.
* gdb.mi/mi-watch-nonstop.exp: Use standard_testfile.
* gdb.mi/mi-watch.exp: Use standard_testfile.
* gdb.mi/mi2-amd64-entry-value.exp: Use standard_testfile.
* gdb.mi/mi2-basics.exp: Use standard_testfile.
* gdb.mi/mi2-break.exp: Use standard_testfile.
* gdb.mi/mi2-cli.exp: Use standard_testfile.
* gdb.mi/mi2-console.exp: Use standard_testfile.
* gdb.mi/mi2-disassemble.exp: Use standard_testfile.
* gdb.mi/mi2-eval.exp: Use standard_testfile.
* gdb.mi/mi2-file.exp: Use standard_testfile.
* gdb.mi/mi2-pthreads.exp: Use standard_testfile.
* gdb.mi/mi2-read-memory.exp: Use standard_testfile.
* gdb.mi/mi2-regs.exp: Use standard_testfile.
* gdb.mi/mi2-return.exp: Use standard_testfile.
* gdb.mi/mi2-simplerun.exp: Use standard_testfile.
* gdb.mi/mi2-stack.exp: Use standard_testfile.
* gdb.mi/mi2-stepi.exp: Use standard_testfile.
* gdb.mi/mi2-syn-frame.exp: Use standard_testfile.
* gdb.mi/mi2-until.exp: Use standard_testfile.
* gdb.mi/mi2-var-block.exp: Use standard_testfile.
* gdb.mi/mi2-var-child.exp: Use standard_testfile.
* gdb.mi/mi2-var-cmd.exp: Use standard_testfile.
* gdb.mi/mi2-var-display.exp: Use standard_testfile.
* gdb.mi/mi2-watch.exp: Use standard_testfile.
mi_run_to_main. Skip thread exit test on remote targets.
* gdb.mi/mi-nsintrall.exp: Don't check isnative. Use
mi_run_to_main.
* gdb.mi/mi-nsmoribund.exp: Don't check isnative. Use
mi_run_to_main.
* lib/mi-support.exp (mi_gdb_target_cmd): Remove trailing anchor
when expecting ^connected. Detect when the target doesn't support
non-stop mode.
(mi_run_cmd): Detect if non-stop mode was requested by isn't
supported. Return -1 on error, 0 on success.
(mi_runto_helper): Don't expect a stop if mi_run_cmd failed.
(mi_runto): Return mi_runto_helper's result explicitly.
(mi_interpreter_init): Register the above.
* solib.c (clear_solib): Notify solib unload.
* breakpoint.c (disable_breakpoints_in_unloaded_shlib): Do not
disable breakpoints on a.out targets.
* breakpoint.c (breakpoint_init_inferior): Clean up the moribund
locations list.
(moribund_breakpoint_here_p): Record the moribund
location in the moribund_locations vector.
* breakpoint.h (moribund_breakpoint_here_p): Declare.
(displaced_step_fixup): Check if the breakpoint the thread was
trying to step over has been removed since having been placed in
the displaced stepping queue.
(adjust_pc_after_break): In non-stop mode, check for a moribund
breakpoint at the stop pc.
(handle_inferior_event): Don't retire moribund breakpoints on
TARGET_WAITKIND_IGNORE.
gdb/testsuite/
* gdb.mi/mi-nsmoribund.exp, gdb.mi/nsmoribund.c: New test.