Commit Graph

542 Commits

Author SHA1 Message Date
Jan Kratochvil 0b10be4faf Fix "ERROR: no fileid for" in the testsuite.
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-16 21:49:40 +01:00
Doug Evans ed3ef33944 Add Guile as an extension language.
* 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-02-09 19:40:01 -08:00
Iain Buclaw 7f420862a7 Add gdb.dlang to the gdb testsuite for the purpose of creating D
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-18 18:09:28 +00:00
Omair Javaid 596662fa99 gdb: ARM: Update configure.tgt and enable gdb.reverse testsuite
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-15 16:57:38 +00:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Andrew Burgess 409d8f4815 Add call to get_compiler_info to gdb_compile_shlib.
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-10 17:04:17 +00:00
Yao Qi 11ec596510 Use gdb_produce_source
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-12-08 15:20:18 +08:00
Andrew Burgess 16b5a7cbae Add support for DW_OP_bit_piece and DW_OP_plus_uconst to DWARF assembler.
https://sourceware.org/ml/gdb-patches/2013-12/msg00143.html

gdb/testsuite/ChangeLog

	* lib/dwarf.exp: (Dwarf::_location): Handle DW_OP_bit_piece and
	DW_OP_plus_uconst.
2013-12-06 13:27:24 +00:00
Keven Boell f84bc21877 testsuite: introduce index in varobj child eval.
In some languages, e.g. fortran, arrays start with index 1
instead 0. This patch changes the MI library to support testing
varobj children of fortran arrays.

2013-11-21  Keven Boell  <keven.boell@intel.com>

testsuite/

	* lib/mi-support.exp (mi_list_varobj_children_range): Add
	call to mi_list_array_varobj_children_with_index.
	(mi_list_array_varobj_children_with_index): New function.
	Add parameter to specify array start.
2013-12-06 10:02:16 +01:00
Yao Qi 8b5e6dc217 GDB perf test on disassemble
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-28 12:53:26 +08:00
Yao Qi 0a1e61210c Check has_more in mi_create_dynamic_varobj
Hi,
I find "has_more" is not checked when a dynamic varobj is created in
proc mi_create_dynamic_varobj.  This patch adds the check to
"has_more".

gdb/testsuite:

2013-11-22  Yao Qi  <yao@codesourcery.com>

	* lib/mi-support.exp (mi_create_dynamic_varobj): Update
	comment and add one more argument "has_more".
	* gdb.python/py-mi.exp: Callers update.
2013-11-22 08:34:42 +08:00
Yao Qi 31b4ab9e37 Remove unnecessary '\'.
Hi,
In proc mi_child_regexp, \(,thread-id=\"\[0-9\]+\") is appended to
children_exp, while the first '\' is not necessary.  This patch
is to remove it.  With this patch applied, Emacs can find the right
left paren.

gdb/testsuite:

2013-11-19  Yao Qi  <yao@codesourcery.com>

	* lib/mi-support.exp (mi_child_regexp): Remove unnecessary '\'.
2013-11-19 21:36:15 +08:00
Yao Qi 4392c53486 Fix format issues in lib/mi-support.exp
There are some format issues in lib/mi-support.exp, such as using
spaces instead of tab and trailing spaces.  This patch is to fix them.

gdb/testsuite:

2013-11-19  Yao Qi  <yao@codesourcery.com>

	* lib/mi-support.exp: Fix format.
2013-11-19 21:35:43 +08:00
Yao Qi 077e2c8848 Remove 'whatever' in lib/mi-support.exp
Variable 'whatever' is not used at all.  This patch is to remove it.

gdb/testsuite:

2013-11-19  Yao Qi  <yao@codesourcery.com>

	* lib/mi-support.exp (mi_child_regexp): Remove 'whatever'.
	(mi_list_varobj_children_range): Likewise.
2013-11-19 15:26:31 +08:00
Luis Machado 6ec41e1e1d * lib/mi-support.exp (mi_gdb_test): Expect different formats
of inferior output for remote and native sessions.
	* gdb.mi/mi-console.exp: Remove obsolete comment.
	Check for semihosted inferior output pattern.
	(semihosted_string): New function.
2013-11-15 19:41:07 -02:00
Yao Qi 6dbb67982c Test on solib load and unload
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-06 13:17:36 +08:00
Yao Qi f27a123653 Perf test framework
This patch adds a basic framework to do performance testing for GDB.
perftest.py is about the test case, testresult.py is about test
results, and how are they saved.  reporter.py is about how results
are reported (in what format).  measure.py is about measuring the
execution of tests by a collection of measurements.

In V5:
 - Simplify perftest.exp.

In V4:

 - Rename MeasurementCPUTime to MeasurementCpuTime,
 - Add 'pass' in empty method,
 - Simplify string comparison in perftest.exp.
 - Rename GDB_PERFORMANCE to GDB_PERFTEST_MODE and rename
   GDB_PERFORMANCE_TIMEOUT to GDB_PERFTEST_TIMEOUT.

In V3, there are some changes,

 - Add wall time measurement, cpu time measurement and vmsize
   measurement.
 - Rename SingleStatisticTestCase to TestCaseWithBasicMeasurements,
   which measures cpu time, wall time, and memory (vmsize).
 - GDB_PERFORMANCE=run|compile|both to control the mode of perf
   testing.
 - New GDB_PERFORMANCE_TIMEOUT to specify the timeout.
 - Split proc prepare to proc compile and startup.
 - Disable GC while doing measurements.

In V2, there are several changes to address Doug and Sanimir's
comments.

 - Add copyright header and docstring in perftest/__init__.py
 - Remove config.py.
 - Fix docstring format.
 - Rename classes "SingleVariable" to "SingleStatistic".
 - Don't extend gdb.Function in class TestCase.  Add a new method run
   to run the test case so that we can pass parameters to test.
 - Allow to customize whether to warm up and to append test log.
 - Move time measurement into test harness.  Add a new class
   Measurement for a specific measurement and a new class Measure to
   measure them for a given test case.
 - A new class ResultFactory to create instances of TestResult.
 - New file lib/perftest.exp, which is to do some preparations and
   cleanups to simplify each *.exp file.
 - Skip compilation step if GDB_PERFORMANCE_SKIP_COMPILE is set.

gdb/testsuite/

2013-11-06  Yao Qi  <yao@codesourcery.com>

	* lib/perftest.exp: New.
	* gdb.perf/lib/perftest/__init__.py: New.
	* gdb.perf/lib/perftest/measure.py: New.
	* gdb.perf/lib/perftest/perftest.py: New.
	* gdb.perf/lib/perftest/reporter.py: New.
	* gdb.perf/lib/perftest/testresult.py: New.
2013-11-06 13:13:15 +08:00
Tom Tromey 1e53777155 introduce relative_filename and use it
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-04 11:02:08 -07:00
Tom Tromey bdfe059466 fix up gdb.gdb
This fixes the gdb.gdb tests to be parallel-safe, by ensuring that the
new "xgdb" file ends up in the standard output directory during the
tests.

2013-11-04  Tom Tromey  <tromey@redhat.com>

	* gdb.gdb/selftest.exp: Use standard_output_file.
	* lib/selftest-support.exp (do_self_tests): Use
	standard_output_file.
2013-11-04 11:01:48 -07:00
Tom Tromey 95d7853ebb fix up log-file toggling
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-11-04 10:55:19 -07:00
Nicolas Blanc e9f0e62efd Function is_elf_target.
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-29 10:56:36 +01:00
Maciej W. Rozycki a35cfb4007 testsuite: Persistent gdbserver cleanup
* 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-25 14:03:00 +00:00
Maciej W. Rozycki bbe769cc07 Avoid producing broken non-native core files
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-25 14:03:00 +00:00
Tom Tromey bb6216d898 * lib/gdb.exp (build_executable_from_specs): Remove duplicate set
of "binfile".
2013-10-18 20:40:03 +00:00
Maciej W. Rozycki e4b8388f81 * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify):
Fix comment typo.
	* lib/gdb.exp (gdb_init): Likewise.
2013-10-17 22:02:29 +00:00
Andreas Krebbel 4f424bb1e7 2013-10-10 Andreas Arnez <arnez@linux.vnet.ibm.com>
* lib/gdb.exp (gdb_core_cmd): Replace fixed string "re-load
	generated corefile" by argument "$test".
2013-10-10 09:54:13 +00:00
Tom Tromey dc294be54c fix PR symtab/15597
This patch fixes gdb PR symtab/15597.

The bug is that the .gnu_debugaltlink section includes the build-id of
the alt file, but gdb does not use it.

This patch fixes the problem by changing gdb to do what it ought to
always have done: verify the build id of the file found using the
filename in .gnu_debugaltlink; and if that does not match, try to find
the correct debug file using the build-id and debug-file-directory.

This patch touches BFD.  Previously, gdb had its own code for parsing
.gnu_debugaltlink; I changed it to use the BFD functions after those
were introduced.  However, the BFD functions are incorrect -- they
assume that .gnu_debugaltlink is formatted like .gnu_debuglink.
However, it it is not.  Instead, it consists of a file name followed
by the build-id -- no alignment, and the build-id is not a CRC.

Fixing this properly is a bit of a pain.  But, because
separate_alt_debug_file_exists just has a FIXME for the build-id case,
I did not fix it properly.  Instead I introduced a hack.  This leaves
BFD working just as well as it did before my patch.

I'm willing to do something better here but I could use some guidance
as to what.  It seems that the build-id code in BFD is largely punted
on.

FWIW gdb is the only user of bfd_get_alt_debug_link_info outside of
BFD itself.

I moved the build-id logic out of elfread.c and into a new file.
This seemed cleanest to me.

Writing a test case was a bit of a pain.  I added a couple new
features to the DWARF assembler to handle this.

Built and regtested on x86-64 Fedora 18.

	* bfd-in2.h: Rebuild.
	* opncls.c (bfd_get_alt_debug_link_info): Add buildid_len
	parameter.  Change type of buildid_out.  Update.
	(get_alt_debug_link_info_shim): New function.
	(bfd_follow_gnu_debuglink): Use it.

	* Makefile.in (SFILES): Add build-id.c.
	(HFILES_NO_SRCDIR): Add build-id.h.
	* build-id.c: New file, largely from elfread.c.  Modified
	most functions.
	* build-id.h: New file.
	* dwarf2read.c (dwarf2_get_dwz_file): Update for change to
	bfd_get_alt_debug_link_info.  Verify dwz file's build-id.
	Search for dwz file using build-id.
	* elfread.c (build_id_bfd_get, build_id_verify)
	(build_id_to_debug_filename, find_separate_debug_file): Remove.

	* gdb.dwarf2/dwzbuildid.exp: New file.
	* lib/dwarf.exp (Dwarf::_section): Add "flags" and "type"
	parameters.
	(Dwarf::_defer_output): Change "section" parameter to
	"section_spec"; update.
	(Dwarf::gnu_debugaltlink, Dwarf::_note, Dwarf::build_id): New
	procs.
2013-10-08 19:56:15 +00:00
Tom Tromey f44eeb117f * lib/mi-support.exp (varobj_tree::walk_tree): Set _root_idx
to 0.
2013-10-07 19:10:45 +00:00
Pedro Alves b477a5e649 Teach the testsuite that GDBserver reliably reports program exits.
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-10-02 11:44:20 +00:00
Tom Tromey 4bda5690b5 revert erroneous checkin to mi-support.exp 2013-09-23 18:11:49 +00:00
Tom Tromey f60e2d5c2a (clh 9) 2013-09-23 18:07:46 +00:00
Doug Evans 6b4646ced5 * lib/dwarf.exp (build_executable_from_fission_assembler): New proc.
* gdb.dwarf2/fission-base.S: Update.  Split out .dwo into separate
	file.
	* gdb.dwarf2/fission-loclists.S: Ditto.
	* gdb.dwarf2/fission-reread.S: Ditto.
	* gdb.dwarf2/fission-base.exp: Skip of remote host.  Compile with
	build_executable_from_fission_assembler.
	* gdb.dwarf2/fission-loclists.exp: Ditto.
	* gdb.dwarf2/fission-reread.exp: Ditto.
2013-09-20 22:43:28 +00:00
Doug Evans 4fa7d39097 * lib/future.exp (gdb_find_objcopy, gdb_find_readelf): New procs.
* 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-20 21:47:06 +00:00
Doug Evans a587b477f2 * lib/gdb.exp (using_fission): New proc.
* gdb.base/info-macros.exp: Skip test if using Fission.
2013-09-16 23:59:02 +00:00
Yao Qi ce4ea2bb17 gdb/testsuite/
* lib/gdb.exp (gdb_remote_download): Don't pass $tofile to
	remote_download if it is empty.
2013-08-27 00:19:02 +00:00
Doug Evans 6e45f15898 * lib/gdb.exp (run_on_host): Moved here from gnu-debugdata.exp.
* gdb.base/gnu-debugdata.exp (run): Moved to gdb.exp and renamed to
	run_on_host.  All callers updated.
2013-08-26 18:30:02 +00:00
Yao Qi b39a8faf7c gdb/testsuite/
* lib/dwarf.exp (_location): Handle DW_OP_deref_size.
	* gdb.trace/entry-values.c: New.
	* gdb.trace/entry-values.exp: New.
2013-08-24 01:53:06 +00:00
Tom Tromey e630b97400 fix dwz.exp on 32-bit targets
This fixes dwz.exp on 32-bit targets.  It does so by introducing a new
"default" setting for the address size in the DWARF assembler.

Built and regtested on x86-64 Fedora 18.
I also ran the gdb.dwarf2 tests on an x86 machine (gcc45).

	* lib/dwarf.exp (cu, tu): Handle addr_size of "default".  Change
	default addr_size.
	* lib/gdb.exp (is_64_target): New gdb_caching_proc.
2013-08-22 14:01:04 +00:00
Tom Tromey f3a764545a convert one more caching proc
I noticed that skip_btrace_tests is a classic "caching proc" that I
missed when I added gdb_caching_proc.  This patch converts it.

Built and regtested on x86-64 Fedora 18.

	* lib/gdb.exp (skip_btrace_tests): Use gdb_caching_proc and
	standard_temp_file.
2013-08-22 13:59:55 +00:00
Tom Tromey 16cfcbc202 use standard_temp_file in another caching proc
In an earlier patch I forgot to change the caching proc in cell.exp to
use standard_temp_file.  This fixes the oversight.

Tested on x86-64 Fedora 18.

       * lib/cell.exp (skip_cell_tests): Use standard_temp_file.
2013-08-22 13:46:21 +00:00
Tom Tromey 44ee81740e introduce gdb_remote_download and finish parallel fixes in gdb.dwarf2
This finishes making gdb.dwarf2 parallel-safe.

To do this, this patch introduces a new gdb_remote_download proc, that
works somewhat differently in the one specific case where it matters:
for a copy to "host", if no destination was given, and the host is not
actually remote, then standard_output_file is used.  In parallel mode
this guarantees that the resulting file will end up in a parallel-safe
location.

Tested on x86-64 Fedora 18.

	* gdb.dwarf2/dw2-basic.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-compressed.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-intercu.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-intermix.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-producer.exp: Use gdb_remote_download.
	* gdb.dwarf2/mac-fileno.exp: Use gdb_remote_download.
	* lib/gdb.exp (gdb_remote_download): New proc.
2013-08-22 13:44:16 +00:00
Doug Evans 70cc1c235f * lib/prelink-support.exp (prelink_yes): Flag test as unsupported if
prelink complains about an unhandled DWARF version.
2013-08-16 17:44:22 +00:00
Tom Tromey 5e92f71a86 introduce parallel mode
This introduces parallel mode for the test suite.

It doesn't fully work yet in the sense that if you do a fully parallel
run, you will encounter some file-name clashes, but this has to start
somewhere, and it seemed best to add some infrastructure now, so that
you can follow along and test subsequent patches if you care to.

This patch has two parts.

First, it checks for the GDB_PARALLEL variable.  If this is set (say,
on the runtest command line), then the test suite assumes "parallel
mode".  In this mode, files are put into a subdirectory named after
the test.  That is, for DIR/TEST.exp, the outputs are put into
./outputs/DIR/TEST/.

This first part has various follow-on changes coming in subsequent
patches.  This is why the code in this patch also makes "temp" and
"cache" directories.

Second, this adds an "inotify" mode.  If you have the inotifywait
command (part of inotify-tools), you can set the GDB_INOTIFY variable.
This will tell the test suite to watch for changes outside of the
allowed output directories.

This mode is useful for debugging the test suite, as it issues a
report whenever a possibly parallel-unsafe file open is done.

2013-08-13  Tom Tromey  <tromey@redhat.com>
	    Yao Qi  <yao@codesourcery.com>

	* lib/cache.exp (gdb_do_cache): Handle GDB_PARALLEL.
	* lib/gdb.exp: Handle GDB_PARALLEL.
	(default_gdb_version): Kill inotify_pid if it exists.
	(default_gdb_exit): Emit warning if the inotify log is not
	empty.
	(standard_output_file): Respect GDB_PARALLEL.
	(standard_temp_file): Likewise.
	(gdb_init): Start inotifywait if requested.

	* gdbint.texinfo (Testsuite): Use @table, not @itemize.
	Document GDB_PARALLEL and GDB_INOTIFY.
2013-08-13 16:12:04 +00:00
Tom Tromey 17e1c970ef add caching procs to test suite
In the fully parallel mode, each .exp file can be run in parallel (at
least conceptually -- the actual split may not be so severe).  This
means that procs that compute a result and cache it are not going to
function very well.  The test they run will be invoked over and over.

This patch introduces a generic caching mechanism and changes various
result-caching procs to use it.  This is a cleanup to introduce the
basic change; the results aren't written to disk yet.

A caching proc is defined using gdb_caching_proc, which works like
"proc", except that it caches the result of the body.

	* lib/cache.exp: New file.
	* lib/cell.exp (skip_cell_tests): Use gdb_caching_proc.
	* lib/gdb.exp: Load cache.exp.
	(support_complex_tests, is_ilp32_target, is_lp64_target)
	(is_amd64_regs_target, skip_altivec_tests, skip_vsx_tests)
	(gdb_skip_xml_test): Use gdb_caching_proc.
	* lib/opencl.exp (skip_opencl_tests): Use gdb_caching_proc.
2013-08-13 15:55:52 +00:00
Tom Tromey 4e2348988f add standard_temp_file
This adds a new helper proc, standard_temp_file.  This proc takes a
file name and returns a possibly-qualified form.  This lets us make
parallel runs use a directory other than ".", which helps the inotify
mode.

This initial patch introduces the proc and changes a few spots to use
it.

	* lib/gdb.exp (standard_temp_file): New proc.
	(support_complex_tests, is_ilp32_target, is_lp64_target)
	(is_amd64_regs_target, skip_altivec_tests, skip_vsx_tests): Use
	standard_temp_file.
2013-08-13 15:52:24 +00:00
Tom Tromey 53e981d986 more uses of standard_output_file
A few spots in lib make output files, either in "." or in
$objdir/$subdir.

This patch changes these spots to use standard_output_file.
This help the parallelization project.

	* lib/gdb.exp (build_id_debug_filename_get): Use
	standard_output_file.
	* lib/prelink-support.exp (section_get)
	(build_executable_own_libs): Use standard_output_file.
2013-08-13 15:50:13 +00:00
Doug Evans f61d552978 * lib/future.exp (gdb_find_ldd): New proc.
* lib/prelink-support.exp (build_executable_own_libs): Call it.
	Make "/usr/sbin/" in prelink path optional.
2013-08-09 17:58:38 +00:00
Yao Qi a075c3e55b gdb/testsuite/
* lib/gdb.exp (gdb_compile_shlib): Pass the tail name of
	$dest to link options if host is remote.  Move the
	generated file to $dest.a on host if host is remote.
2013-07-18 22:38:58 +00:00
Yao Qi 1f74d3b559 gdb/testsuite/
* lib/future.exp (gdb_default_target_compile): Use tail name
	of $destfile as the output name of compile.  Move the
	generated file to $destfile on build.
2013-07-18 05:13:27 +00:00
Yao Qi f6dc277e05 gdb/testsuite/
* lib/gdb.exp (gdb_compile): Set
	gdb_saved_set_unbuffered_mode_obj to
	set_unbuffered_mode_saved.o if host is remote.  Invoke
	remote_download to copy $unbuf_obj to host.
2013-07-18 05:07:25 +00:00