aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb.exp
AgeCommit message (Collapse)AuthorFilesLines
2014-10-18Skip testing argv[0] on target argv[0] isn't availableYao Qi1-0/+98
I see the following two fails on arm-none-eabi target, because argv[0] isn't available. print argv[0]^M $1 = 0x1f78 "/dev/null"^M (gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name print argv[0]^M $1 = 0x1f78 "/dev/null"^M (gdb) FAIL: gdb.base/argv0-symlink.exp: kept directory symbolic link name My first thought is to check [target_info exists noargs], and skip the test if it returns true. However, noargs is set in gdbserver board files, so argv0-symlink.exp will be skipped on gdbserver board file. The change is too aggressive. When the program is running with gdbserver, argv[1] to argv[N] aren't available, but argv[0] is. Fortunately, argv0-symlink.exp only requires argv[0]. argv0-symlink.exp can be run with gdbserver board file, as what we do now. What we need to check is whether argv[0] is available, so I add a new proc gdb_has_argv0 to do so by starting a program, and check argc/argv[0] to see whether argv[0] is available. Dan fixed the similar problem by checking noargs, which is too strong. https://sourceware.org/ml/gdb-patches/2010-02/msg00398.html as a result, the test is skipped on gdbserver. This patch fixed it too. gdb/testsuite: 2014-10-18 Yao Qi <yao@codesourcery.com> * gdb.base/argv0-symlink.exp: Check argv[0] value if gdb_has_argv0 return true. * gdb.guile/scm-value.exp (test_value_in_inferior): Don't check [target_info exists noargs], check [gdb_has_argv0] instead. * gdb.python/py-value.exp (test_value_in_inferior): Likewise. * lib/gdb.exp (gdb_has_argv0, gdb_has_argv0_1): New procedures.
2014-10-17Copy xml files to hostYao Qi1-1/+3
When I run test with board file local-remote-host-native.exp, I see the following warning, $ make check RUNTESTFLAGS="--host_board=local-remote-host-native --target_board=local-remote-host-native tdesc-arch.exp HOST_DIR=/tmp/foo/" (gdb) set tdesc filename ../../../../git/gdb/testsuite/gdb.xml/trivial.xml^M warning: Could not open "../../../../git/gdb/testsuite/gdb.xml/trivial.xml" (gdb) quit^ because "${srcdir}/gdb.xml/trivial.xml" doesn't exist on host. This patch is to copy trivial.xml to host and the warning goes away. (gdb) set tdesc filename /tmp/foo/trivial.xml^M (gdb) quit^ tdesc-regs.exp has the similar problem that single-reg.xml may not exist on host at all, and it should be copied to host too. gdb/testsuite: 2014-10-17 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (gdb_skip_xml_test): Copy trivial.xml to host. * gdb.xml/tdesc-regs.exp: Copy single-reg.xml to host.
2014-10-10Delete IRIX supportPedro Alves1-6/+2
This does most of the mechanical removal. IOW, the easy part. This doesn't touch procfs.c as that'd be a harder excision, potentially affecting Solaris. mips-tdep.c is left alone. E.g., I didn't delete the GDB_OSABI_IRIX enum value, nor references to it in mips-tdep.c. Some comments mentioning IRIX ABIs may still be relevant and I wouldn't know what to do with them. in That can always be done on a separate pass, preferably by someone who can test on MIPS. I didn't remove a reference to IRIX in testsuite/lib/future.exp, as I believe that code is imported from DejaGNU. Built and tested on x86_64 Fedora 20, with --enable-targets=all. Tested that building for --target=mips-sgi-irix6 on x86_64 Fedora 20 fails with: checking for default auto-load directory... $debugdir:$datadir/auto-load checking for default auto-load safe-path... $debugdir:$datadir/auto-load *** Configuration mips-sgi-irix6 is obsolete. *** Support has been REMOVED. make[1]: *** [configure-gdb] Error 1 make[1]: Leaving directory `/home/pedro/gdb/mygit/build-irix' make: *** [all] Error 2 gdb/ 2014-10-10 Pedro Alves <palves@redhat.com> * Makefile.in (ALL_TARGET_OBS): Remove mips-irix-tdep.o and solib-irix.o. (ALLDEPFILES): Remove mips-irix-tdep.c and solib-irix.c. (HFILES_NO_SRCDIR): Remove solib-irix.h. * NEWS: Mention that support for mips-sgi-irix5* mips-sgi-irix6* and been removed. * config/mips/irix5.mh, config/mips/irix6.mh: Delete files. * configure.ac: Remove references to IRIX. * configure.host: Add *-*-irix* to the obsolete hosts section. Remove all other references to irix. * irix5-nat.c, mips-irix-tdep.c, solib-irix.c, solib-irix.h: Delete files. gdb/testsuite/ 2014-10-10 Pedro Alves <palves@redhat.com> * gdb.base/bigcore.exp: Remove references to IRIX. * gdb.base/funcargs.exp: Likewise. * gdb.base/interrupt.exp: Likewise. * gdb.base/mips_pro.exp: Likewise. * gdb.base/nodebug.exp: Likewise. * gdb.base/setvar.exp: Likewise. * lib/gdb.exp (gdb_compile_shlib): Remove mips-sgi-irix* case.
2014-09-16Remove support for testing against dead "target vxworks"Pedro Alves1-4/+0
"target vxworks" and friends have been removed 10 years ago already: commit e84ecc995d6a5e4e9114d3cea61717b8a573afb6 Author: Andrew Cagney <cagney@redhat.com> AuthorDate: Sat Nov 13 23:10:02 2004 +0000 2004-11-13 Andrew Cagney <cagney@gnu.org> * configure.tgt: Delete i[34567]86-*-vxworks*, m68*-netx-*, m68*-*-vxworks*, mips*-*-vxworks*, powerpc-*-vxworks*, and sparc-*-vxworks*. * NEWS: Mention that vxworks was deleted. (...) * remote-vxmips.c, remote-vx.c: Delete. * remote-vx68.c: Delete. (...) This removes related leftover cruft from the testsuite. Tested on x86_64 Fedora 20, native and gdbserver. gdb/testsuite/ 2014-09-16 Pedro Alves <palves@redhat.com> * config/vx.exp, config/vxworks.exp, config/vxworks29k.exp: Delete files. * gdb.base/a2-run.exp: Remove all code guarded by istarget "*-*-vxworks*" throughout. * gdb.base/break.exp: Likewise. * gdb.base/default.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/break.c: Remove all code guarded by #ifdef vxworks throughout. * gdb.base/run.c: Likewise. * gdb.base/sepdebug.c: Likewise. * gdb.hp/gdb.aCC/run.c: Likewise. * gdb.reverse/until-reverse.c: Likewise. * lib/gdb.exp (gdb_compile): Remove is_vxworks branch.
2014-09-13Pass plain-text prompt to with_gdb_prompt.Doug Evans1-2/+29
I had occasion to use with_gdb_prompt in a test for the patch for PR 17314 and was passing the plain text prompt as the value, "(top-gdb)", instead of a regexp, "\(top-gdb\)" (expressed as "\\(top-gdb\\)" in TCL). I then discovered that in order to restore the prompt gdb passes the original value of $gdb_prompt to "set prompt", which works because "set prompt \(gdb\) " is equivalent to "set prompt (gdb) ". Perhaps I'm being overly cautious but this feels a bit subtle, but at any rate as an API choice I'd much rather pass the plain text form to with_gdb_prompt. I also discovered that the initial value of gdb_prompt is set in two places to two different values. At the global level gdb.exp sets it to "\[(\]gdb\[)\]" and default_gdb_init sets it to "\\(gdb\\)". The former form is undesirable as an argument to "set prompt", but it's not clear to me that just deleting this code won't break anything. Thus I just changed the value to be consistent and added a comment. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_prompt): Add comment and change initial value to be consistent with what default_gdb_init uses. (with_gdb_prompt): Change form of PROMPT argument from a regexp to the plain text of the prompt. Add some logging printfs. * gdb.perf/disassemble.exp: Update call to with_gdb_prompt.
2014-09-11gdb/17347 - Regression: GDB stopped on run with attached processPedro Alves1-0/+16
Doing: gdb --pid=PID -ex run Results in GDB getting a SIGTTIN, and thus ending stopped. That's usually indicative of a missing target_terminal_ours call. E.g., from the PR: $ sleep 1h & p=$!; sleep 0.1; gdb -batch sleep $p -ex run [1] 28263 [1] Killed sleep 1h [2]+ Stopped gdb -batch sleep $p -ex run The workaround is doing: gdb -ex "attach $PID" -ex "run" instead of gdb [-p] $PID -ex "run" With the former, gdb waits for the attach command to complete before moving on to the "run" command, because the interpreter is in sync mode at this point, within execute_command. But for the latter, attach_command is called directly from captured_main, and thus misses that waiting. IOW, "run" is running before the attach continuation has run, before the program stops and attach completes. The broken terminal settings are just one symptom of that. Any command that queries or requires input results in the same. The fix is to wait in catch_command_errors (which is specific to main.c nowadays), just like we wait in execute_command. gdb/ChangeLog: 2014-09-11 Pedro Alves <palves@redhat.com> PR gdb/17347 * main.c: Include "infrun.h". (catch_command_errors, catch_command_errors_const): Wait for the foreground command to complete. * top.c (maybe_wait_sync_command_done): New function, factored out from ... (maybe_wait_sync_command_done): ... here. * top.h (maybe_wait_sync_command_done): New declaration. gdb/testsuite/ChangeLog: 2014-09-11 Pedro Alves <palves@redhat.com> PR gdb/17347 * lib/gdb.exp (gdb_spawn_with_cmdline_opts): New procedure. * gdb.base/attach.exp (test_command_line_attach_run): New procedure. (top level): Call it.
2014-09-11testsuite: refactor spawn and wait for attachPedro Alves1-0/+25
Several places in the testsuite have a copy of a snippet of code that spawns a test program, waits a bit, and then does some PID munging for Cygwin. This is in order to have GDB attach to the spawned program. This refactors all that to a common procedure. (multi-attach.exp wants to spawn multiple processes, so this makes the new procedure's interface work with lists.) Tested on x86_64 Fedora 20. gdb/testsuite/ChangeLog: 2014-09-11 Pedro Alves <palves@redhat.com> * lib/gdb.exp (spawn_wait_for_attach): New procedure. * gdb.base/attach.exp (do_attach_tests, do_call_attach_tests) (do_command_attach_tests): Use spawn_wait_for_attach. * gdb.base/solib-overlap.exp: Likewise. * gdb.multi/multi-attach.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.python/py-sync-interp.exp: Likewise. * gdb.server/ext-attach.exp: Likewise.
2014-09-09GDB/testsuite: Avoid timeout loweringMaciej W. Rozycki1-40/+17
The recent change to introduce `gdb_reverse_timeout' turned out ineffective for board setups that set the `gdb,timeout' target variable. A lower `gdb,timeout' setting takes precedence and defeats the effect of `gdb_reverse_timeout'. This is because the global timeout is overridden in gdb_test_multiple and then again in gdb_expect. Three timeout variables are taken into account in these two places, in this precedence: 1. The `gdb,timeout' target variable. 2. The caller's local `timeout' variable (upvar timeout) 3. The global `timeout' variable. This precedence is obeyed by gdb_test_multiple strictly. OTOH gdb_expect will select the higher of the two formers and will only take the latter into account if none of the formers is present. However the two timeout selections are conceptually the same and gdb_test_multiple does its only for the purpose of passing it down to gdb_expect. Therefore I decided there is no point to keep carrying on this duplication and removed the sequence from gdb_test_multiple, however retaining the `upvar timeout' variable definition. This way gdb_expect will still access gdb_test_multiple's caller `timeout' variable (if any) via its own `upvar timeout' reference. Now as to the sequence in gdb_expect. In addition to the three variables described above it also takes a timeout argument into account, as the fourth value to choose from. It is currently used if it is higher than the timeout selected from the variables as described above. With the timeout selection code from gdb_test_multiple gone, gone is also the most prominent use of this timeout argument, it's now used in a couple of places only, mostly within this test framework library code itself for preparatory commands or suchlike. With this being the case this timeout selection code can be simplified as follows: 1. Among the three timeout variables, the highest is always chosen. This is so that a test case doesn't inadvertently lower a high value timeout needed by slow target boards. This is what all test cases use. 2. Any timeout argument takes precedence. This is for special cases such as within the framework library code, e.g. it doesn't make sense to send `set height 0' with a timeout of 7200 seconds. This is a local command that does not interact with the target and setting a high timeout here only risks a test suite run taking ages if it goes astray for some reason. 3. The fallback timeout of 60s remains. * lib/gdb.exp (gdb_test_multiple): Remove code to select the timeout, don't pass one down to gdb_expect. (gdb_expect): Rework timeout selection.
2014-08-27lib/gdb.exp (gdb_compile_shlib): Add support for clang.Doug Evans1-0/+6
gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_compile_shlib): Add support for clang.
2014-08-21Remove useless gcore command detectionPedro Alves1-6/+0
Checking whether the gcore command is included in the GDB build as proxy for checking whether core dumping is supported by the target is useless, as gcore.o has been in COMMON_OBS since git 9b4eba8e: 2009-10-26 Michael Snyder <msnyder@vmware.com> Hui Zhu <teawater@gmail.com> * Makefile.in (SFILES): Add gcore.c. (COMMON_OBS): Add gcore.o. * config/alpha/alpha-linux.mh (NATDEPFILES): Delete gcore.o. * config/alpha/fbsd.mh (NATDEPFILES): Ditto. ... IOW, the command is always included in the build. Instead, nowadays, tests bail out if actually trying to generate a core fails with an indication the target doesn't support it. See gdb_gcore_cmd and callers. Tested on x86_64 Fedora 20. gdb/testsuite/ChangeLog: * gdb.base/gcore-buffer-overflow.exp: Remove "help gcore" test. * gdb.base/gcore-relro-pie.exp: Likewise. * gdb.base/gcore-relro.exp: Likewise. * gdb.base/gcore.exp: Likewise. * gdb.base/print-symbol-loading.exp: Likewise. * gdb.threads/gcore-thread.exp: Likewise. * lib/gdb.exp (gdb_gcore_cmd): Don't expect "Undefined command".
2014-08-09Remove duplicated code on checking address 0x0 is accessiableYao Qi1-0/+18
I find some gdb.python tests fail on arm-none-eabi target, because the tests assume that memory on address 0x is inaccessible. Some tests (in gdb.base) are aware of this, so do a "x 0" check first. However, the code is copy-n-paste. This patch is to move the "x 0" check to a procedure in lib/gdb.exp, and get needed tests call it. The original code matches pattern "0x0:\[ \t\]*Error accessing memory address 0x0\r\n$gdb_prompt $", but I remove it from the new proc is_address_zero_readable, because GDB doesn't emit such message any more. gdb/testsuite: 2014-08-09 Yao Qi <yao@codesourcery.com> * gdb.base/display.exp: Invoke is_address_zero_readable. * gdb.guile/scm-value.exp (test_value_in_inferior): Likewise. * gdb.python/py-value.exp (test_value_in_inferior): Likewise. * gdb.base/hbreak-unmapped.exp: Return if is_address_zero_readable returns true. * gdb.base/signest.exp: Likewise. * gdb.base/signull.exp: Likewise. * gdb.base/sigbpt.exp: Likewise. * gdb.guile/scm-disasm.exp: Do the test if is_address_zero_readable returns false. * gdb.guile/scm-pretty-print.exp (run_lang_tests): Likewise. * gdb.python/py-arch.exp: Likewise. * gdb.python/py-prettyprint.exp (run_lang_tests): Likewise. * lib/gdb.exp (is_address_zero_readable): New proc.
2014-07-25Fix paginate-*.exp racesPedro Alves1-11/+3
Jan pointed out in <https://sourceware.org/ml/gdb-patches/2014-07/msg00553.html> that these testcases have racy results: gdb.base/double-prompt-target-event-error.exp gdb.base/paginate-after-ctrl-c-running.exp gdb.base/paginate-bg-execution.exp gdb.base/paginate-execution-startup.exp gdb.base/paginate-inferior-exit.exp This is easily reproducible with "read1" from: [reproducer for races of expect incomplete reads] http://sourceware.org/bugzilla/show_bug.cgi?id=12649 The '-notransfer -re "<return>" { exp_continue }' trick in the current tests doesn't actually work. The issue that led to the -notransfer trick was that "---Type <return> to continue, or q <return> to quit---" has two "<return>"s. If one wants gdb_test_multiple to not hit the built-in "<return>" match that results in FAIL, one has to expect the pagination prompt in chunks, first up to the first "<return>", then again, up to the second. Something around these lines: gdb_test_multiple "" $test { -re "<return>" { exp_continue } -re "to quit ---" { pass $test } } The intent was for -notransfer+exp_continue to make expect fetch more input, and rerun the matches against the now potentially fuller buffer, and then eventually the -re that includes the full pagination prompt regex would match instead (because it's listed higher up, it would match first). But, once that "<return>" -notransfer -re matches, it keeps re-matching forever. It seems like with exp_continue, expect immediately retries matching, instead of first reading in more data into the buffer, if available. Fix this like I should have done in the first place. There's actually no good reason for gdb_test_multiple to only match "<return>". We can make gdb_test_multiple expect the whole pagination prompt text instead, which is store in the 'pagination_prompt' global (similar to 'gdb_prompt'). Then a gdb_test_multiple caller that doesn't want the default match to trigger, because it wants to see one pagination prompt, does simply: gdb_test_multiple "" $test { -re "$pagination_prompt$" { pass $test } } which is just like when we don't want the default $gdb_prompt match within gdb_test_multiple to trigger, like: gdb_test_multiple "" $test { -re "$gdb_prompt $" { pass $test } } Tested on x86_64 Fedora 20. In addition, I've let the racy tests run all in parallel in a loop for 30 minutes, and they never failed. gdb/testsuite/ 2014-07-25 Pedro Alves <palves@redhat.com> * gdb.base/double-prompt-target-event-error.exp (cancel_pagination_in_target_event): Remove '-notransfer <return>' match. (cancel_pagination_in_target_event): Rework double prompt detection. * gdb.base/paginate-after-ctrl-c-running.exp (test_ctrlc_while_target_running_paginates): Remove '-notransfer <return>' match. * gdb.base/paginate-bg-execution.exp (test_bg_execution_pagination_return) (test_bg_execution_pagination_cancel): Remove '-notransfer <return>' matches. * gdb.base/paginate-execution-startup.exp (test_fg_execution_pagination_return) (test_fg_execution_pagination_cancel): Remove '-notransfer <return>' matches. * gdb.base/paginate-inferior-exit.exp (test_paginate_inferior_exited): Remove '-notransfer <return>' match. * lib/gdb-utils.exp (string_to_regexp): Move here from lib/gdb.exp. * lib/gdb.exp (pagination_prompt): Run text through string_to_regexp. (gdb_test_multiple): Match $pagination_prompt instead of "<return>". (string_to_regexp): Move to lib/gdb-utils.exp.
2014-07-14Canceling pagination caused by execution command from command line aborts ↵Pedro Alves1-12/+49
readline/gdb This fixes: $ ./gdb program -ex "set height 2" -ex "start" ... Reading symbols from /home/pedro/gdb/tests/threads...done. ---Type <return> to continue, or q <return> to quit---^CQuit << ctrl-c triggers a Quit *type something* readline: readline_callback_read_char() called with no handler! Aborted $ Usually, if an error propagates all the way to the top level, we'll re-enable stdin, in case the command that was running was a synchronous command. That's done in the event loop's actual loop (event-loop.c:start_event_loop). However, if a foreground execution command is run before the event loop starts and throws, nothing is presently reenabling stdin, which leaves sync_execution set. When we do start the event loop, because sync_execution is still (mistakenly) set, display_gdb_prompt removes the readline input callback, even though stdin is registered in the event loop. Any input from here on results in readline aborting. Such commands are run through catch_command_errors, catch_command_errors_const, so add the tweak there. gdb/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * main.c: Include event-top.h. (handle_command_errors): New function. (catch_command_errors, catch_command_errors_const): Use it. gdb/testsuite/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * gdb.base/paginate-execution-startup.c: New file. * gdb.base/paginate-execution-startup.exp: New file. * lib/gdb.exp (pagination_prompt): New global. (default_gdb_spawn): New procedure, factored out from default_gdb_spawn. (default_gdb_start): Adjust to call default_gdb_spawn. (gdb_spawn): New procedure.
2014-07-14testsuite: Introduce gdb_assertPedro Alves1-0/+21
Often we'll do something like: if {$ok} { fail "whatever" } else { pass "whatever" } This adds a helper procedure for that, and converts one random place to use it, as an example. 2014-07-14 Pedro Alves <palves@redhat.com> * lib/gdb.exp (gdb_assert): New procedure. * gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
2014-07-12gdb/testsuite: Add a way to send multiple init commandsMaciej W. Rozycki1-4/+5
Right now we provide a board info entry, `gdb_init_command', that allows one to send a single command to GDB before the program to be debugged is started. This is useful e.g. for slow remote targets to change the default "remotetimeout" setting. Occasionally I found a need to send multiple commands instead, however this cannot be achieved with `gdb_init_command'. This change therefore extends the mechanism by adding a TCL list of GDB commands to send, via a board info entry called `gdb_init_commands'. There is no limit as to the number of commands put there. The old `gdb_init_command' mechanism remains supported for compatibility with existing people's environments. * lib/gdb-utils.exp: New file. * lib/gdb.exp (gdb_run_cmd): Call gdb_init_commands, replacing inline `gdb_init_command' processing. (gdb_start_cmd): Likewise. * lib/mi-support.exp (mi_run_cmd): Likewise. * README: Document `gdb_init_command' and `gdb_init_commands'.
2014-05-23test, gcore: move capture_command_output into lib/gdb.expMarkus Metzger1-0/+14
Allow gcore's capture_command_output function to be used by other tests. testsuite/ * gdb.base/gcore.exp (capture_command_output): Move ... * lib/gdb.exp (capture_command_output): ... here.
2014-05-21gdb/testsuite: Bump up `match_max'Maciej W. Rozycki1-2/+3
This fixes: PASS: gdb.base/info-macros.exp: info macro -a -- FOO ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros 2 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros 3 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros 4 FAIL: gdb.base/info-macros.exp: info macros *$pc ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: next FAIL: gdb.base/info-macros.exp: info macros ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: next FAIL: gdb.base/info-macros.exp: info macros 6 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: next FAIL: gdb.base/info-macros.exp: info macros 7 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros info-macros.c:42 (PRMS gdb/NNNN) with the arm-eabi target tested on the i686-mingw32 host where GCC defines enough macros to exhaust expect's 30000 characters of buffer space. * lib/gdb.exp (default_gdb_init): Bump `match_max' up from 30000 to 65536.
2014-05-20Set timeout for gdb.reverse/*.exp test casesYao Qi1-0/+5
Hi, This patch is to add a new board setting gdb_reverse_timeout, which is used to set timeout for all gdb.reverse test cases, which are usually very slow and cause some TIMEOUT failures, for example, on some arm boards. We have some alternatives to this approach, but I am not satisfied with them: - Increase the timeout value. This is the global change, and it may cause some delay where actual failures happen. - Set timeout by gdb_reverse_timeout in every gdb.reverse/*.exp. Then, we have to touch every file under gdb.reverse. In this patch, we choose a central place to set timeout for all tests in gdb.reverse, which is convenient. gdb/testsuite: 2014-05-20 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (gdb_init): Set timeout if test file is under gdb.reverse directory and gdb_reverse_timeout exists in board setting. * README: Document gdb_reverse_timeout.
2014-05-20gdb_init argument ARGS is a string rather than a listYao Qi1-10/+6
The argument ARGS of gdb_init is passed from dejagnu is a string, the test file name. In dejagnu/runtest.exp: proc runtest { test_file_name } { .... .... if [info exists tool] { if { [info procs "${tool}_init"] != "" } { ${tool}_init $test_file_name; } } .... } but inn default_gdb_init (callee of gdb_init), we have set gdb_test_file_name [file rootname [file tail [lindex $args 0]]] In tcl, all actual arguments are combined to a list and assigned to args. This code here isn't wrong, but unnecessary, because its caller (proc runtest) only passes one string to it, and IMO, we don't need such tricky tcl "args". I doubt that "[lindex $args 0]" is to be backward compatible with old dejagnu, but dejagnu-1.4 release started to pass $test_file_name to ${too}_init, as I showed above. dejagnu-1.4 was released in 2001, and it should be old enough. I also tried to check whether gdb testusite works with dejagnu-1.3 or not, but failed to build dejagnu-1.3 on my machine. Supposing GDB testsuite requires at least dejagnu-1.4, this change should be safe. This patch is update default_gdb_init to treat ARGS as a string instead of a list. Then, 'args' sounds like a list, and this patch also renames it by 'test_file_name', to align with dejagnu. gdb/testsuite: 2014-05-20 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (default_gdb_init): Rename argument 'args' by 'test_file_name'. Treat args as a string instead of a list. (gdb_init): Rename argument 'args' by 'test_file_name'.
2014-05-02gdb_load: Fix latent bugsPedro Alves1-2/+5
In a test I was writting, I needed a procedure that would connect to the target, and do "load", or equivalent. Years ago, boards would override gdb_load to implement that. Then gdb_reload was added, and gdb_load was relaxed to allow boards avoid the spawing and connecting to the target. This sped up gdbserver testing. See https://www.sourceware.org/ml/gdb-patches/2007-02/msg00318.html. To actually spawn the target and load the executable on the target side, gdb_reload was born: # gdb_reload -- load a file into the target. Called before "running", # either the first time or after already starting the program once, # for remote targets. Most files that override gdb_load should now # override this instead. proc gdb_reload { } { # For the benefit of existing configurations, default to gdb_load. # Specifying no file defaults to the executable currently being # debugged. return [gdb_load ""] } Note the comment about specifying no file. Indeed looking at config/sid.exp, or config/monitor.exp, we see examples of that. However, the default gdb_load itself doesn't handle the case of no file specified. When passed no file, it just calls gdb_file_cmd with no file either, which ends up invocing the "file" command with no argument, which means unloading the file and its symbols... That means calling gdb_reload when testing against native targets is broken. We don't see that today because the only call to gdb_reload that exists today is guarded by target_info exists gdb,do_reload_on_run. The native-extended-gdbserver.exp board is likewise broken here. When [gdb_load ""] is called, the board sets the remote exec-file to "" ... Tested on x86_64 Fedora 17, native, remote gdbserver and extended-remote gdbserver. testsuite/ 2014-05-01 Pedro Alves <palves@redhat.com> * lib/gdb.exp (gdb_load): Extend comment. Skip calling gdb_file_cmd if no file is specified. * boards/native-extended-gdbserver.exp (gdb_load): Use the last_loaded_file to set the remote exec-file.
2014-04-23Introduce some new MI test suite cleanups for breakpoint andKeith Seitz1-0/+63
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.
2014-04-23Don't suppress errors inserting/removing hardware breakpoints in sharedPedro Alves1-0/+19
libraries. As explained in https://sourceware.org/ml/gdb-patches/2008-08/msg00361.html, after a shared library was unloaded, we can no longer insert or remove breakpoints into/from its (no longer present) code segment. That'll fail with memory errors. However, that concern does not apply to hardware breakpoints. By definition, hardware breakpoints are implemented using a mechanism that is not dependent on being able to modify the target's memory. Usually, by setting up CPU debug registers. IOW, we should be able to set hw breakpoints in an unmapped address. We don't seem to have a test that exercises that, so this patch adds one. I noticed the error supression because of a related issue -- the target_insert_hw_breakpoint/target_remove_hw_breakpoint interfaces don't really distinguish "not supported" from "error" return, and so remote.c returns -1 in both cases. This results in hardware breakpoints set in shared libraries silently ending up pending forever even though the target doesn't actually support hw breakpoints. (gdb) set breakpoint always-inserted on (gdb) set remote Z-packet off (gdb) info breakpoints No breakpoints or watchpoints. (gdb) hbreak shrfunc Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21. (gdb) info break Num Type Disp Enb Address What 3 hw breakpoint keep y <PENDING> shrfunc After the patch we get the expected: (gdb) hbreak shrfunc Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21. Warning: Cannot insert hardware breakpoint 3. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. (gdb) info break Num Type Disp Enb Address What 3 hw breakpoint keep y 0x00007ffff7dfb657 in shrfunc at ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c:21 (HW breakpoints set in the main executable, when the target doesn't support HW breakpoints always resulted in the latter output.) We probably should improve the insert/remove interface to return a different error code for unsupported. But I chose to fix the error supression first, as it's a deeper and wider issue. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2014-04-23 Pedro Alves <palves@redhat.com> * breakpoint.c (insert_bp_location, remove_breakpoint_1): If the breakpoint is set in a shared library, only suppress errors for software breakpoints, not hardware breakpoints. gdb/testsuite/ 2014-04-23 Pedro Alves <palves@redhat.com> * gdb.base/hbreak-in-shr-unsupported-shr.c: New file. * gdb.base/hbreak-in-shr-unsupported.c: New file. * gdb.base/hbreak-in-shr-unsupported.exp: New file. * gdb.base/hbreak-unmapped.c: New file. * gdb.base/hbreak-unmapped.exp: New file. * gdb.trace/qtro.exp (gdb_is_target_remote): Move ... * lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-22Make gdb_continue_to_breakpoint fail quickly on internal errors.Pedro Alves1-8/+1
This switches the gdb_continue_to_breakpoint routine to use gdb_test_multiple instead of send_gdb/gdb_expect, so that an internal error is detected immediately, instead of failing on timeout. gdb/testsuite/ 2014-04-22 Pedro Alves <palves@redhat.com> * lib/gdb.exp (gdb_continue_to_breakpoint): Use gdb_test_multiple instead of send_gdb/gdb_expect.
2014-04-17Drop prefix from unsupported source path.Marcus Shawcroft1-2/+2
2014-04-17[testsuite] Set target-charset to asciiYao Qi1-0/+33
Hi, We find gdb.base/printcmds.exp fails a lot on windows host, like this, p ctable1[163] $204 = 163 '£' (gdb) FAIL: gdb.base/printcmds.exp: p ctable1[163] however, on linux host, p ctable1[163] $205 = 163 '\243' (gdb) PASS: gdb.base/printcmds.exp: p ctable1[163] The printing related code is in valprint.c:print_wchar, if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w) && w != LCST ('8') && w != LCST ('9')))) { gdb_wchar_t wchar = w; if (w == gdb_btowc (quoter) || w == LCST ('\\')) obstack_grow_wstr (output, LCST ("\\")); obstack_grow (output, &wchar, sizeof (gdb_wchar_t)); } else { // print W in hex or octal digits } When I debug gdb on different hosts, I find on windows host, gdb_iswprint (iswprint) returns true if 'w' is 163. However, on linux host, iswprint returns false if 'w' is 163. Looks this difference is caused by the charset. On Linux host, the target-charset is ANSI_X3.4-1968, while on windows host, the target-charset is CP1252. We can see how target-charset affects the output. On linux host, (gdb) set target-charset ASCII (gdb) p ctable1[163] $1 = 163 '\243' (gdb) set target-charset CP1252 (gdb) p ctable1[163] $2 = 163 '£' we can print the pound sign too, and it shows target-charset does affect the output. This patch is to set target-charset temporarily to ASCII for some charset-sensitive tests. Tested on arm-none-eabi and powerpc-linux-gnu on mingw32 host. More than one hundred fails are fixed. gdb/testsuite: 2014-04-17 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (with_target_charset): New proc. * gdb.base/printcmds.exp (test_print_all_chars): Wrap tests with with_target_charset. (test_print_strings): Likewise. (test_repeat_bytes): Likewise. * gdb.base/setvar.exp: Set target-charset to ASCII temporarily for some tests.
2014-03-27Return zero in can_single_step_to_signal_handler for nios2-*-* targetYao Qi1-1/+2
nios2 uses software single step, so GDB is unable to single step to the signal handler. In order to reflect this, teach can_single_step_to_signal_handler to return zero for nios2 target. gdb/testsuite: 2014-03-27 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (can_single_step_to_signal_handler): Return zero if target is nios2-*-*.
2014-03-26Skip tests on completion and readline when readline lib isn't usedYao Qi1-0/+15
The completion feature and other features on readline depend on the readline library. However, readline library is not always used, for example, running testsuite like make check RUNTESTFLAGS="--host_board=local-remote-host" the input stream is not a tty, and GDB doesn't use readline library as a result. This patch is to skip tests on completion and readline if 'show editing' is off, which means readline isn't used. Note that some tests in gdb.base/completion.exp test command complete, which isn't related to readline, so these tests aren't affected by readline library. This patch also moves these tests up, run them unconditionally, and run the rest if readline library is used. gdb/testsuite: 2014-03-26 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (readline_is_used): New proc. * gdb.base/completion.exp: Move tests on command complete up. Skip the rest of tests if readline is not used. * gdb.ada/complete.exp: Skp the test if readline is not used. * gdb.base/filesym.exp: Likewise. * gdb.base/macscp.exp: Likewise. * gdb.base/readline-ask.exp: Likewise. * gdb.base/readline.exp: Likewise. * gdb.python/py-cmd.exp: Likewise. * gdb.trace/tfile.exp: Likewise.
2014-03-12gdb.exp: Support absolute path name args in 'prepare_for_testing' etc.Andreas Arnez1-2/+9
Test cases that produce source files in the build directory have not been able to use prepare_for_testing and friends. This was because build_executable_from_specs unconditionally prepended the source directory path name to its arguments.
2014-02-24lib/gdb.exp (run_on_host): Log error output if program fails.Doug Evans1-0/+1
2014-02-16Fix "ERROR: no fileid for" in the testsuite.Jan Kratochvil1-1/+2
If GDB has crashed then gdb_spawn_id still exists (although it does not work). So my patch does not change anything. And also currently it will leave the stale gdbserver running anyway. In general if gdb_spawn_id does not exist then send_gdb + gdb_expect just do not make sense anyway. So this patch just prevents the error in such case. The killing of stale gdbserver could be improved multiple ways (also as suggested by Pedro in the original thread) but that is IMO outside of the scope of this patch. Apparently if there is no good response from GDB then gdb_finish() should try to call gdb_start just to kill that gdbserver, IIUC. gdb/testsuite/ 2014-02-16 Jan Kratochvil <jan.kratochvil@redhat.com> Fix "ERROR: no fileid for" in the testsuite. * lib/gdb.exp (gdb_finish): Check gdb_spawn_id. Message-ID: <20140206205814.GA18495@host2.jankratochvil.net>
2014-02-09Add Guile as an extension language.Doug Evans1-0/+17
* NEWS: Mention Guile scripting. * Makefile.in (SUBDIR_GUILE_OBS): New variable. (SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables (SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables. (INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS. (CLIBS): Add GUILE_LIBS. (install-guile): New rule. (guile.o): New rule. (scm-arch.o, scm-auto-load.o, scm-block.o): New rules. (scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules. (scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules. (scm-math.o, scm-objfile.o, scm-ports.o): New rules. (scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules. (scm-string.o, scm-symbol.o, scm-symtab.o): New rules. (scm-type.o, scm-utils.o, scm-value.o): New rules. * configure.ac: New option --with-guile. * configure: Regenerate. * config.in: Regenerate. * auto-load.c: Remove #include "python/python.h". Add #include "gdb/section-scripts.h". (source_section_scripts): Handle Guile scripts. (_initialize_auto_load): Add name of Guile objfile script to scripts-directory help text. * breakpoint.c (condition_command): Tweak comment to include Scheme. * breakpoint.h (gdbscm_breakpoint_object): Add forward decl. (struct breakpoint): New member scm_bp_object. * defs.h (enum command_control_type): New value guile_control. * cli/cli-cmds.c: Remove #include "python/python.h". Add #include "extension.h". (show_user): Update comment. (_initialize_cli_cmds): Update help text for "show user". Update help text for max-user-call-depth. * cli/cli-script.c: Remove #include "python/python.h". Add #include "extension.h". (multi_line_command_p): Add guile_control. (print_command_lines): Handle guile_control. (execute_control_command, recurse_read_control_structure): Ditto. (process_next_line): Recognize "guile" commands. * disasm.c (gdb_disassemble_info): Make non-static. * disasm.h: #include "dis-asm.h". (struct gdbarch): Add forward decl. (gdb_disassemble_info): Declare. * extension.c: #include "guile/guile.h". (extension_languages): Add guile. (get_ext_lang_defn): Handle EXT_LANG_GDB. * extension.h (enum extension_language): New value EXT_LANG_GUILE. * gdbtypes.c (get_unsigned_type_max): New function. (get_signed_type_minmax): New function. * gdbtypes.h (get_unsigned_type_max): Declare. (get_signed_type_minmax): Declare. * guile/README: New file. * guile/guile-internal.h: New file. * guile/guile.c: New file. * guile/guile.h: New file. * guile/scm-arch.c: New file. * guile/scm-auto-load.c: New file. * guile/scm-block.c: New file. * guile/scm-breakpoint.c: New file. * guile/scm-disasm.c: New file. * guile/scm-exception.c: New file. * guile/scm-frame.c: New file. * guile/scm-gsmob.c: New file. * guile/scm-iterator.c: New file. * guile/scm-lazy-string.c: New file. * guile/scm-math.c: New file. * guile/scm-objfile.c: New file. * guile/scm-ports.c: New file. * guile/scm-pretty-print.c: New file. * guile/scm-safe-call.c: New file. * guile/scm-string.c: New file. * guile/scm-symbol.c: New file. * guile/scm-symtab.c: New file. * guile/scm-type.c: New file. * guile/scm-utils.c: New file. * guile/scm-value.c: New file. * guile/lib/gdb.scm: New file. * guile/lib/gdb/boot.scm: New file. * guile/lib/gdb/experimental.scm: New file. * guile/lib/gdb/init.scm: New file. * guile/lib/gdb/iterator.scm: New file. * guile/lib/gdb/printing.scm: New file. * guile/lib/gdb/types.scm: New file. * data-directory/Makefile.in (GUILE_SRCDIR): New variable. (VPATH): Add $(GUILE_SRCDIR). (GUILE_DIR): New variable. (GUILE_INSTALL_DIR, GUILE_FILES): New variables. (all): Add stamp-guile dependency. (stamp-guile): New rule. (clean-guile, install-guile, uninstall-guile): New rules. (install-only): Add install-guile dependency. (uninstall): Add uninstall-guile dependency. (clean): Add clean-guile dependency. doc/ * Makefile.in (GDB_DOC_FILES): Add guile.texi. * gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts. (Extending GDB): New menu entries Guile, Multiple Extension Languages. (Guile docs): Include guile.texi. (objfile-gdbdotext file): Add objfile-gdb.scm. (dotdebug_gdb_scripts section): Mention Guile scripts. (Multiple Extension Languages): New node. * guile.texi: New file. testsuite/ * configure.ac (AC_OUTPUT): Add gdb.guile. * configure: Regenerate. * lib/gdb-guile.exp: New file. * lib/gdb.exp (get_target_charset): New function. * gdb.base/help.exp: Update expected output from "apropos apropos". * gdb.guile/Makefile.in: New file. * gdb.guile/guile.exp: New file. * gdb.guile/scm-arch.c: New file. * gdb.guile/scm-arch.exp: New file. * gdb.guile/scm-block.c: New file. * gdb.guile/scm-block.exp: New file. * gdb.guile/scm-breakpoint.c: New file. * gdb.guile/scm-breakpoint.exp: New file. * gdb.guile/scm-disasm.c: New file. * gdb.guile/scm-disasm.exp: New file. * gdb.guile/scm-equal.c: New file. * gdb.guile/scm-equal.exp: New file. * gdb.guile/scm-error.exp: New file. * gdb.guile/scm-error.scm: New file. * gdb.guile/scm-frame-args.c: New file. * gdb.guile/scm-frame-args.exp: New file. * gdb.guile/scm-frame-args.scm: New file. * gdb.guile/scm-frame-inline.c: New file. * gdb.guile/scm-frame-inline.exp: New file. * gdb.guile/scm-frame.c: New file. * gdb.guile/scm-frame.exp: New file. * gdb.guile/scm-generics.exp: New file. * gdb.guile/scm-gsmob.exp: New file. * gdb.guile/scm-iterator.c: New file. * gdb.guile/scm-iterator.exp: New file. * gdb.guile/scm-math.c: New file. * gdb.guile/scm-math.exp: New file. * gdb.guile/scm-objfile-script-gdb.in: New file. * gdb.guile/scm-objfile-script.c: New file. * gdb.guile/scm-objfile-script.exp: New file. * gdb.guile/scm-objfile.c: New file. * gdb.guile/scm-objfile.exp: New file. * gdb.guile/scm-ports.exp: New file. * gdb.guile/scm-pretty-print.c: New file. * gdb.guile/scm-pretty-print.exp: New file. * gdb.guile/scm-pretty-print.scm: New file. * gdb.guile/scm-section-script.c: New file. * gdb.guile/scm-section-script.exp: New file. * gdb.guile/scm-section-script.scm: New file. * gdb.guile/scm-symbol.c: New file. * gdb.guile/scm-symbol.exp: New file. * gdb.guile/scm-symtab-2.c: New file. * gdb.guile/scm-symtab.c: New file. * gdb.guile/scm-symtab.exp: New file. * gdb.guile/scm-type.c: New file. * gdb.guile/scm-type.exp: New file. * gdb.guile/scm-value-cc.cc: New file. * gdb.guile/scm-value-cc.exp: New file. * gdb.guile/scm-value.c: New file. * gdb.guile/scm-value.exp: New file. * gdb.guile/source2.scm: New file. * gdb.guile/types-module.cc: New file. * gdb.guile/types-module.exp: New file.
2014-01-18Add gdb.dlang to the gdb testsuite for the purpose of creating DIain Buclaw1-0/+6
specific tests. gdb/testsuite/ChangeLog: 2014-01-17 Iain Buclaw <ibuclaw@gdcproject.org> * configure.ac: Create gdb.dlang/Makefile. * configure: Regenerate. * Makefile.in (ALL_SUBDIRS): Add gdb.dlang. * gdb.dlang/Makefile.in: New file. * lib/d-support.exp: New file. * lib/gdb.exp (skip_d_tests): New proc.
2014-01-15gdb: ARM: Update configure.tgt and enable gdb.reverse testsuiteOmair Javaid1-2/+4
gdb/testsuite/ChangeLog: 2014-01-15 Omair Javaid <omair.javaid@linaro.org> * lib/gdb.exp (supports_process_record): Return true for arm*-linux*. (supports_reverse): Likewise.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-12-10Add call to get_compiler_info to gdb_compile_shlib.Andrew Burgess1-2/+9
https://sourceware.org/ml/gdb-patches/2013-12/msg00374.html gdb/testsuite/ChangeLog * lib/gdb.exp (gdb_compile_shlib): Add call to get_compiler_info, update comment.
2013-12-08Use gdb_produce_sourceYao Qi1-51/+54
We added a new proc gdb_produce_source recently, and it can be used more widely in lib/gdb.exp to generate source file. gdb/testsuite: 2013-12-08 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (support_complex_tests): Use gdb_produce_source. (is_elf_target, is_ilp32_target, is_ilp64_target): Likewise. (is_64_target, is_amd64_regs_target): Likewise. (skip_altivec_tests, skip_vsx_tests, skip_btrace_tests): Likewise.
2013-11-28GDB perf test on disassembleYao Qi1-0/+26
This patch adds a test case to test the performance of GDB doing disassembly. gdb/testsuite/ 2013-11-28 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (with_gdb_prompt): New proc. * gdb.perf/disassemble.exp: New. * gdb.perf/disassemble.py: New.
2013-11-06Test on solib load and unloadYao Qi1-0/+10
This patch is to add a test case to on the performance of GDB handling load and unload of shared library. In V4: - Handle malloc and dlopen failure, - Document test parameters. In V3, there are some changes, - Adapt to perf test framework changes. - Measure load and unload separately. In V2, there are some changes, - A new proc gdb_produce_source to produce source files. I tried to move all source file generation code out of solib.exp, but compilation step still needs to know the generated file names. I have to hard-code the file names in compilation step, which is not good to me, so I give up on this moving. - SOLIB_NUMBER -> SOLIB_COUNT - New variable SOLIB_DLCLOSE_REVERSED_ORDER to control the order of iterating a list of shared libs to dlclose them. - New variable GDB_PERFORMANCE to enable these perf test cases. - Remove dlsym call in solib.c. - Update solib.py for the updated framework. gdb/testsuite/ * lib/gdb.exp (gdb_produce_source): New procedure. * gdb.perf/solib.c: New. * gdb.perf/solib.exp: New. * gdb.perf/solib.py: New.
2013-11-04introduce relative_filename and use itTom Tromey1-0/+19
This introduces a new relative_filename proc to gdb.exp and changes some tests to use it. This helps make these tests parallel-safe. 2013-11-04 Tom Tromey <tromey@redhat.com> * gdb.base/fullname.exp: Use standard_output_file, relative_filename. * gdb.base/hashline1.exp: Use standard_testfile, standard_output_file, relative_filename, clean_restart. * gdb.base/hashline2.exp: Use standard_testfile, standard_output_file. * gdb.base/hashline3.exp: Use standard_testfile, standard_output_file, relative_filename. * lib/gdb.exp (relative_filename): New proc.
2013-11-04fix up log-file togglingTom Tromey1-1/+2
Currently a proc in gdb.exp toggles the expect (and thus dejagnu) logging. This is not a super idea, but it is there to avoid putting some preprocessor output into the log. In the right circumstances, this can result in the log file being mysteriously truncated. I think this happens because it doesn't necessarily write to the correct log file again. The fix is to use "log_file -info" to save the previous log file. 2013-11-04 Tom Tromey <tromey@redhat.com> * lib/gdb.exp (get_compiler_info): Use log_file -info and restore from that.
2013-10-29Function is_elf_target.Nicolas Blanc1-0/+39
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> gdb/testsuite * lib/gdb.exp (is_elf_target): New function. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-25testsuite: Persistent gdbserver cleanupMaciej W. Rozycki1-0/+15
* lib/gdb.exp (gdb_finish): Send a kill request to `gdbserver' if in the persistent mode. * gdb.trace/disconnected-tracing.exp: Reconnect before completion.
2013-10-25Avoid producing broken non-native core filesMaciej W. Rozycki1-1/+1
gdb/ * linux-tdep.c (linux_corefile_thread_callback): Propagate any failure from register information collection. gdb/testsuite/ * lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not support core file generation" reply.
2013-10-18 * lib/gdb.exp (build_executable_from_specs): Remove duplicate setTom Tromey1-2/+0
of "binfile".
2013-10-17 * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify):Maciej W. Rozycki1-1/+1
Fix comment typo. * lib/gdb.exp (gdb_init): Likewise.
2013-10-102013-10-10 Andreas Arnez <arnez@linux.vnet.ibm.com>Andreas Krebbel1-7/+7
* lib/gdb.exp (gdb_core_cmd): Replace fixed string "re-load generated corefile" by argument "$test".
2013-10-02Teach the testsuite that GDBserver reliably reports program exits.Pedro Alves1-6/+15
Running catch-syscall.exp against a gdbserver that actually supports it, we get: FAIL: gdb.base/catch-syscall.exp: continue until exit (the program exited) FAIL: gdb.base/catch-syscall.exp: continue until exit (the program exited) FAIL: gdb.base/catch-syscall.exp: continue until exit (the program exited) FAIL: gdb.base/catch-syscall.exp: continue until exit at catch syscall with unused syscall (mlock) (the program exited) FAIL: gdb.base/catch-syscall.exp: continue until exit (the program exited) The fail pattern is: Catchpoint 2 (call to syscall exit_group), 0x000000323d4baa29 in _exit () from /lib64/libc.so.6 (gdb) PASS: gdb.base/catch-syscall.exp: program has called exit_group delete breakpoints Delete all breakpoints? (y or n) y (gdb) info breakpoints No breakpoints or watchpoints. (gdb) break exit Breakpoint 3 at 0x323d438bf0 (gdb) continue Continuing. [Inferior 1 (process 21081) exited normally] That "break exit" + "continue" comes from: > # gdb_continue_to_end: > # The case where the target uses stubs has to be handled specially. If a > # stub is used, we set a breakpoint at exit because we cannot rely on > # exit() behavior of a remote target. > # The native-gdbserver.exp board, used to test against gdbserver in "target remote" mode, triggers that case ($use_gdb_stub is true). So gdb_continue_to_end doesn't work for catch-syscall.exp as here we catch the exit_group and continue from that, expecting to see a real program exit. I was about to post a patch that changes catch-syscall.exp to call a new function that just always does what gdb_continue_to_end does in the !$use_gdb_stub case. But, since GDBserver doesn't really need this, in the end I thought it better to teach the testsuite that there are stubs that know how to report program exits, by adding a new "exit_is_reliable" board variable that then gdb_continue_to_end checks. Tested on x86_64 Fedora 17, native and gdbserver. gdb/testsuite/ 2013-10-02 Pedro Alves <palves@redhat.com> * README (Board Settings): Document "exit_is_reliable". * lib/gdb.exp (gdb_continue_to_end): Check whether the board says running to exit reliably reports program exits. * boards/native-gdbserver.exp: Set exit_is_reliable in the board info. * boards/native-stdio-gdbserver.exp: Likewise.
2013-09-20 * lib/future.exp (gdb_find_objcopy, gdb_find_readelf): New procs.Doug Evans1-2/+2
* lib/gdb.exp (build_id_debug_filename_get): Update to use them. (gdb_gnu_strip_debug): Ditto. * lib/prelink-support.exp (section_get, prelink_no): Ditto. * gdb.arch/altivec-abi.exp: Ditto. * gdb.base/attach-pie-misread.exp: Ditto. * gdb.base/comprdebug.exp: Ditto. * gdb.base/dup-sect.exp: Ditto. * gdb.base/gnu-debugdata.exp: Ditto. * gdb.base/step-symless.exp: Ditto. * gdb.dwarf2/dw2-inline-param.exp: Ditto. * gdb.dwarf2/dw2-skip-prologue.exp: Ditto. * gdb.dwarf2/gdb-index.exp: Ditto.
2013-09-16 * lib/gdb.exp (using_fission): New proc.Doug Evans1-0/+10
* gdb.base/info-macros.exp: Skip test if using Fission.
2013-08-27gdb/testsuite/Yao Qi1-1/+6
* lib/gdb.exp (gdb_remote_download): Don't pass $tofile to remote_download if it is empty.