aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.multi
AgeCommit message (Collapse)AuthorFilesLines
2014-05-29enable target async by default; separate MI and target notions of asyncPedro Alves1-1/+1
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.
2014-04-25PR server/16255: gdbserver cannot attach to a second inferior that is ↵Pedro Alves2-0/+108
multi-threaded. On Linux, we need to explicitly ptrace attach to all lwps of a process. Because GDB might not be connected yet when an attach is requested, and thus it may not be possible to activate thread_db, as that requires access to symbols (IOW, gdbserver --attach), a while ago we make linux_attach loop over the lwps as listed by /proc/PID/task to find the lwps to attach to. linux_attach_lwp_1 has: ... if (initial) /* If lwp is the tgid, we handle adding existing threads later. Otherwise we just add lwp without bothering about any other threads. */ ptid = ptid_build (lwpid, lwpid, 0); else { /* Note that extracting the pid from the current inferior is safe, since we're always called in the context of the same process as this new thread. */ int pid = pid_of (current_inferior); ptid = ptid_build (pid, lwpid, 0); } That "safe" comment referred to linux_attach_lwp being called by thread-db.c. But this was clearly missed when a new call to linux_attach_lwp_1 was added to linux_attach. As a result, current_inferior will be set to some random process, and non-initial lwps of the second inferior get assigned the pid of the wrong inferior. E.g., in the case of attaching to two inferiors, for the second inferior (and so on), non-initial lwps of the second inferior get assigned the pid of the first inferior. This doesn't trigger on the first inferior, when current_inferior is NULL, add_thread switches the current inferior to the newly added thread. Rather than making linux_attach switch current_inferior temporarily (thus avoiding further reliance on global state), or making linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls, and will be wrong in case of the user having originally attached directly to a non-tgid lwp, and then that lwp spawning new clones (the ptid.pid field of further new clones should be the same as the original lwp's pid, which is not the tgid), we note that callers of linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy already, so they can pass it down along with the lwpid. The only other reason for the "initial" parameter is to error out instead of warn in case of attach failure, when we're first attaching to a process. There are only three callers of linux_attach_lwp/linux_attach_lwp_1, and each wants to print a different warn/error string, so we can just move the error/warn out of linux_attach_lwp_1 to the callers, thus getting rid of the "initial" parameter. There really nothing gdbserver-specific about attaching to two threaded processes, so this adds a new test under gdb.multi/. The test passes cleanly against the native GNU/Linux target, but fails/triggers the bug against GDBserver (before the patch), with the native-extended-remote board (as plain remote doesn't support multi-process). Tested on x86_64 Fedora 17, with the native-extended-gdbserver board. gdb/gdbserver/ 2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * linux-low.c (linux_attach_fail_reason_string): New function. (linux_attach_lwp): Delete. (linux_attach_lwp_1): Rename to ... (linux_attach_lwp): ... this. Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach): Adjust to call linux_attach_lwp. Call error on failure to attach to the tgid. Call warning when failing to attach to an lwp. * linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach_fail_reason_string): New declaration. * thread-db.c (attach_thread): Adjust to linux_attach_lwp's interface change. Use linux_attach_fail_reason_string. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ... (linux_ptrace_attach_fail_reason): ... this. Remove "warning: " and newline from built string. * common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ... (linux_ptrace_attach_fail_reason): ... this. * linux-nat.c (linux_nat_attach): Adjust to use linux_ptrace_attach_fail_reason. gdb/testsuite/ 2014-04-25 Simon Marchi <simon.marchi@ericsson.com> Pedro Alves <palves@redhat.com> PR server/16255 * gdb.multi/multi-attach.c: New file. * gdb.multi/multi-attach.exp: New file.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker10-10/+10
2013-11-13fix multi-arch-exec for parallel modeTom Tromey2-3/+6
I noticed today that multi-arch-exec.exp was failing in parallel mode. The bug is that multi-arch-exec.c assumes the non-parallel directory layout. This patch fixes the problem using the same "BASEDIR" approach used in other tests. Tested both ways on x86-64 Fedora 18. I'm checking this in. 2013-11-13 Tom Tromey <tromey@redhat.com> * gdb.multi/multi-arch-exec.exp: Define BASEDIR when compiling. * gdb.multi/multi-arch-exec.c (main): Use BASEDIR.
2013-11-04fix some "exec" testsTom Tromey2-4/+8
A few tests run an inferior that execs some other program. The name of this exec'd program is compiled in. These tests assume the current test suite directory layout, but fail in parallel mode. This patch fixes these tests by letting the .exp files pass in the directory names at compile time. 2013-11-04 Tom Tromey <tromey@redhat.com> * gdb.base/foll-exec.c (main): Use BASEDIR. * gdb.base/foll-exec.exp: Define BASEDIR during compilation. * gdb.base/foll-vfork.c (main): Use BASEDIR. * gdb.base/foll-vfork.exp: Define BASEDIR during compilation. * gdb.multi/bkpt-multi-exec.c (main): Use BASEDIR. * gdb.multi/bkpt-multi-exec.exp: Define BASEDIR during compilation.
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker10-10/+10
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.
2012-12-17Enable accidentally commented out code.Doug Evans1-3/+3
2012-12-13 * gdb.multi/multi-arch-exec.exp: Skip for i*86-linux.Doug Evans2-0/+12
* gdb.multi/multi-arch.exp: Ditto.
2012-11-092012-11-09 Pedro Alves <palves@redhat.com>Pedro Alves2-0/+93
PR gdb/14306 * infrun.c: Include target-descriptions.h. (follow_exec): Fetch new target description. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> PR gdb/14306 * gdb.multi/multi-arch-exec.c: New file. * gdb.multi/multi-arch-exec.exp: New file.
2012-11-09gdb/Pedro Alves1-0/+76
2012-11-09 Pedro Alves <palves@redhat.com> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. (get_target_gdbarch) <gdbarch.h>: New function. (startup_gdbarch) <gdbarch.h>: Declare. <gdbarch.c> (target_gdbarch): Delete. <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. <gdbarch.c> (get_target_gdbarch): New function. * inferior.c: Include target-descriptions.h. (free_inferior): Free target description info. (add_inferior_with_spaces): Set the inferior's initial architecture. (clone_inferior_command): Copy the original inferior's target description if it was user specified. (initialize_inferiors): Add comment. * inferior.h (struct target_desc_info): Forward declare. (struct inferior) <gdbarch>: New field. * linux-nat.c: Include target-descriptions.h. (linux_child_follow_fork): Copy the parent's architecture and target description to the child. * target-descriptions.c: Include inferior.h. (struct target_desc_info): New structure, holding the equivalents of ... (target_desc_fetched, current_target_desc) (target_description_filename): ... these removed globals. (get_tdesc_info, target_desc_info_from_user_p) (copy_inferior_target_desc_info, target_desc_info_free): New. (target_desc_fetched, current_target_desc) (target_description_filename): Reimplemented as convenience macros. (tdesc_filename_cmd_string): New global. (set_tdesc_filename_cmd): Copy the string manipulated by the "set tdescs filename ..." commands to the per-inferior equivalent. (show_tdesc_filename_cmd): Get the value to show from the per-inferior description filename. (_initilize_target_descriptions): Change the "set/show tdesc filename" commands' variable. * target-descriptions.h (struct target_desc, struct target_desc_info) (struct inferior): Forward declare. (target_find_description, target_clear_description) (target_current_description): Adjust comments. (copy_inferior_target_desc_info, target_desc_info_free) (target_desc_info_from_user_p). Declare. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch.exp: New.
2012-06-25 * gdb.multi/watchpoint-multi.exp: Use standard_testfile.Tom Tromey3-15/+12
* gdb.multi/bkpt-multi-exec.exp: Use standard_output_file. Use build_executable, not prepare_for_testing. * gdb.multi/base.exp: Use standard_output_file. Use build_executable, not prepare_for_testing.
2012-05-17 * Makefile.in (clean): Remove Fission .dwo and .dwp files.Doug Evans1-0/+1
* gdb.ada/Makefile.in (clean): Ditto. * gdb.arch/Makefile.in (clean): Ditto. * gdb.asm/Makefile.in (clean): Ditto. * gdb.base/Makefile.in (clean): Ditto. * gdb.cell/Makefile.in (clean): Ditto. * gdb.cp/Makefile.in (clean): Ditto. * gdb.disasm/Makefile.in (clean): Ditto. * gdb.dwarf2/Makefile.in (clean): Ditto. * gdb.fortran/Makefile.in (clean): Ditto. * gdb.go/Makefile.in (clean): Ditto. * gdb.hp/Makefile.in (clean): Ditto. * gdb.hp/gdb.aCC/Makefile.in (clean): Ditto. * gdb.hp/gdb.base-hp/Makefile.in (clean): Ditto. * gdb.hp/gdb.compat/Makefile.in (clean): Ditto. * gdb.hp/gdb.defects/Makefile.in (clean): Ditto. * gdb.hp/gdb.objdbg/Makefile.in (clean): Ditto. * gdb.java/Makefile.in (clean): Ditto. * gdb.linespec/Makefile.in (clean): Ditto. * gdb.mi/Makefile.in (clean): Ditto. * gdb.modula2/Makefile.in (clean): Ditto. * gdb.multi/Makefile.in (clean): Ditto. * gdb.objc/Makefile.in (clean): Ditto. * gdb.opencl/Makefile.in (clean): Ditto. * gdb.opt/Makefile.in (clean): Ditto. * gdb.pascal/Makefile.in (clean): Ditto. * gdb.python/Makefile.in (clean): Ditto. * gdb.reverse/Makefile.in (clean): Ditto. * gdb.server/Makefile.in (clean): Ditto. * gdb.stabs/Makefile.in (clean): Ditto. * gdb.threads/Makefile.in (clean): Ditto. * gdb.trace/Makefile.in (clean): Ditto. * gdb.xml/Makefile.in (clean): Ditto.
2012-05-03gdb/testsuite:Yao Qi1-5/+6
* gdb.base/catch-syscall.exp: Skip it before compilation if target doesn't support. * gdb.base/foll-exec.exp, gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp, gdb.multi/bkpt-multi-exec.exp: Likewise.
2012-01-262012-01-26 Pedro Alves <palves@redhat.com>Pedro Alves1-9/+15
Make test messages unique, and more identifiable. * gdb.multi/watchpoint-multi.exp: Change test messages.
2012-01-24gdb/Jan Kratochvil2-0/+142
Fix watchpoints to be specific for each inferior. * breakpoint.c (watchpoint_in_thread_scope): Verify also current_program_space. * i386-nat.c (i386_inferior_data_cleanup): New. (i386_inferior_data_get): Replace variable inf_data_local by an inferior_data call. (i386_use_watchpoints): Initialize i386_inferior_data. * linux-nat.c (linux_nat_iterate_watchpoint_lwps): Use INFERIOR_PTID specific iterate_over_lwps. gdb/testsuite/ Fix watchpoints to be specific for each inferior. * gdb.multi/watchpoint-multi.c: New file. * gdb.multi/watchpoint-multi.exp: New file.
2012-01-04Copyright year update in most files of the GDB Project.Joel Brobecker5-5/+5
gdb/ChangeLog: Copyright year update in most files of the GDB Project.
2011-02-272011-02-25 Michael Snyder <msnyder@vmware.com>Michael Snyder1-0/+31
* inferior.c (detach_inferior_command): Use get_number_or_range. (kill_inferior_command): Ditto. (remove_inferior_command): Ditto. (initialize_inferiors): Make command names plural. Update help strings. 2011-02-25 Michael Snyder <msnyder@vmware.com> * gdb.texinfo (Inferiors and Programs): Update commands to show that they can accept multiple arguments. 2011-02-25 Michael Snyder <msnyder@vmware.com> * gdb.multi/base.exp: Add test for remove-inferiors.
2011-02-252011-02-25 Michael Snyder <msnyder@vmware.com>Michael Snyder1-0/+54
* inferior.c (print_inferior): Accept a string instead of an int for requested_inferiors, and use get_number_or_range to parse it. (info_inferiors_command): Pass args string to print_inferior. (initialize_inferiors): Change help string for info inferiors. * inferior.h (print_inferior): Export prototype change. 2011-02-25 Michael Snyder <msnyder@vmware.com> * gdb.multi/base.exp: Add tests for info inferiors with args.
2011-02-222011-02-22 Michael Snyder <msnyder@vmware.com>Michael Snyder1-1/+1
* Makefile.in: Make more clean. * gdb.ada/Makefile.in: Ditto. * gdb.arch/Makefile.in: Ditto. * gdb.asm/Makefile.in: Ditto. * gdb.base/Makefile.in: Ditto. * gdb.cp/Makefile.in: Ditto. * gdb.dwarf2/Makefile.in: Ditto. * gdb.java/Makefile.in: Ditto. * gdb.mi/Makefile.in: Ditto. * gdb.modula2/Makefile.in: Ditto. * gdb.python/Makefile.in: Ditto. * gdb.server/Makefile.in: Ditto. * gdb.stabs/Makefile.in: Ditto. * gdb.threads/Makefile.in: Ditto. * gdb.trace/Makefile.in: Ditto.
2011-01-01run copyright.sh for 2011.Joel Brobecker5-5/+5
2010-06-18 * gdb.multi/base.exp, gdb.multi/bkpt-multi-exec.exp: UsePedro Alves2-27/+25
clean_restart, make sure every test has a distinct message, and that messages don't include the executable' full path.
2010-06-102010-06-08 Michael Snyder <msnyder@vmware.com>Michael Snyder2-3/+3
* gdb.ada/assign_1.exp: Use ".*" instead of "" as wildcard regexp. * gdb.ada/boolean_expr.exp: * gdb.ada/frame_args.exp: Ditto. * gdb.ada/lang_switch.exp: Ditto. * gdb.ada/ptype_arith_binop.exp: Ditto. * gdb.ada/ref_param.exp: Ditto. * gdb.ada/type_coercion.exp:Ditto. * gdb.asm/asm-source.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/bitfields2.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/dbx.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/dump.exp: Ditto. * gdb.base/exprs.exp: Ditto. * gdb.base/freebpcmd.exp: Ditto. * gdb.base/interrupt.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/long_long.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/ptype.exp: Ditto. * gdb.base/return.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/sigbpt.exp: Ditto. * gdb.base/sigrepeat.exp: Ditto. * gdb.cp/classes.exp: Ditto. * gdb.dwarf2/dw2-restore.exp: Ditto. * gdb.gdb/selftest.exp: Ditto. * gdb.multi/base.exp: Ditto. * gdb.multi/bkpt-multi-exec.exp: Ditto. * gdb.python/py-block.exp: Ditto. * gdb.python/py-prettyprint.exp: Ditto. * gdb.python/py-template.exp: Ditto. * gdb.server/ext-attach.exp: Ditto. * gdb.server/ext-run.exp: Ditto. * gdb.server/server-mon.exp: Ditto. * gdb.threads/fork-thread-pending.exp: Ditto. * gdb.threads/hand-call-in-threads.exp: Ditto. * gdb.threads/interrupted-hand-call.exp: Ditto. * gdb.threads/linux-dp.exp: Ditto. * gdb.threads/manythreads.exp: Ditto. * gdb.threads/print-threads.exp: Ditto. * gdb.threads/pthreads.exp: Ditto. * gdb.threads/schedlock.exp: Ditto. * gdb.threads/thread-unwindonsignal.exp: Ditto. * gdb.threads/threadapply.exp: Ditto.
2010-06-022010-06-02 Michael Snyder <msnyder@vmware.com>Michael Snyder1-1/+1
* gdb.dwarf2/dw2-basic.exp: Use gdb_test_no_output. * gdb.dwarf2/dw2-compressed.exp: Ditto. * gdb.dwarf2/dw2-intercu.exp: Ditto. * gdb.dwarf2/dw2-intermix.exp: Ditto. * gdb.dwarf2/dw2-producer.exp: Ditto. * gdb.dwarf2/mac-fileno.exp: Ditto. * gdb.gdb/observer.exp: Use gdb_test_no_output. * gdb.gdb/selftest.exp: Ditto. * gdb.multi/base.exp: Use gdb_test_no_output. * gdb.opt/inline-cmds.exp: Use gdb_test_no_output.
2010-01-01Update copyright year in most headers.Joel Brobecker5-5/+5
Automatic update by copyright.sh.
2009-10-19Adding files to HEAD that cvs had declared dead due to existing onPedro Alves8-0/+359
the branch only. gdb/testsuite/ * gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork". * gdb.base/foll-exec.exp: Adjust to expect a process id before "Executing new program". * gdb.base/foll-fork.exp: Adjust to spell out "follow-fork". * gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being left listed after having been killed. * gdb.base/attach.exp: Adjust to spell out "symbol-file". * gdb.base/maint.exp: Adjust test. * Makefile.in (ALL_SUBDIRS): Add gdb.multi. * gdb.multi/Makefile.in: New. * gdb.multi/base.exp: New. * gdb.multi/goodbye.c: New. * gdb.multi/hangout.c: New. * gdb.multi/hello.c: New. * gdb.multi/bkpt-multi-exec.c: New. * gdb.multi/bkpt-multi-exec.exp: New. * gdb.multi/crashme.c: New.