old-cross-binutils/gdb/testsuite/lib
Kevin Buettner 2223449a47 gdb.dwarf2: Define and use gdb_target_symbol for symbol prefixes
Some of the tests in gdb.dwarf2 which use Dwarf::assemble refer to
(minimal/linker) symbols created in the course of building a small
test program.  Some targets use a prefix such as underscore ("_") on
these symbols.  Many of the tests in gdb.dwarf2 do not take this into
account.  As a consequence, these tests fail to build, resulting
either in failures or untested testcases.

Here is an example from gdb.dwarf2/dw2-regno-invalid.exp:

    Dwarf::assemble $asm_file {
        cu {} {
            compile_unit {
                {low_pc main DW_FORM_addr}
                {high_pc main+0x10000 DW_FORM_addr}
            } {
            ...
            }

For targets which require an underscore prefix on linker symbols,
the two occurrences of "main" would have to have a prepended underscore,
i.e. _main instead of main.

For the above case, a call to the new proc gdb_target_symbol is used
prepend the correct prefix to the symbol.  I.e. the above code is
rewritten (as shown in the patch) as follows:

    Dwarf::assemble $asm_file {
        cu {} {
            compile_unit {
                {low_pc [gdb_target_symbol main] DW_FORM_addr}
                {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
            } {
            ...
            }

I also found it necessary to make an adjustment to lib/dwarf.exp so that
expressions of more than just one list element can be used in DW_TAG_...
constructs.  Both atomic-type.exp and dw2-bad-mips-linkage-name.exp require
this new functionality.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_target_symbol_prefix, gdb_target_symbol):
	New procs.
	* lib/dwarf.exp (_handle_DW_TAG): Handle attribute values,
	representing expressions, of more than one list element.
	* gdb.dwarf2/atomic-type.exp (Dwarf::assemble): Use gdb_target_symbol
	to prepend linker symbol prefix to f.
	* gdb.dwarf2/data-loc.exp (Dwarf::assemble): Likewise, for
	table_1 and table_2.
	* gdb.dwarf2/dw2-bad-mips-linkage-name.exp (Dwarf::assemble):
	Likewise, for f and g.
	* gdb.dwarf2/dw2-ifort-parameter.exp (Dwarf::assemble): Likewise,
	for ptr.
	* gdb.dwarf2/dw2-regno-invalid.exp (Dwarf::assemble): Likewise,
	for main.
	* gdb.dwarf2/dynarr-ptr.exp (Dwarf::assemble): Likewise, for
	table_1_ptr and table_2_ptr.
2015-11-05 15:22:51 -07:00
..
ada.exp
append_gdb_boards_dir.exp
build-piece.exp Add parallel build support for perf tests. 2015-08-03 09:17:40 -07:00
cache.exp Add parallel build support for perf tests. 2015-08-03 09:17:40 -07:00
cell.exp Report UNRESOLVED on failures while detecting Cell/B.E. 2015-08-27 19:06:03 +02:00
cl_util.c
cl_util.h
compiler.c
compiler.cc
cp-support.exp
d-support.exp
dtrace.exp
dwarf.exp gdb.dwarf2: Define and use gdb_target_symbol for symbol prefixes 2015-11-05 15:22:51 -07:00
fortran.exp
future.exp Workaround debian change to default value of --as-needed. 2015-07-24 15:24:37 -07:00
gdb-guile.exp
gdb-python.exp
gdb-utils.exp
gdb.exp gdb.dwarf2: Define and use gdb_target_symbol for symbol prefixes 2015-11-05 15:22:51 -07:00
gdbserver-support.exp Test --wrapper in extended-remote 2015-07-24 14:40:34 +01:00
gen-perf-test.exp Add perf testcase generator. 2015-07-24 15:43:15 -07:00
go.exp
java.exp
mi-support.exp PR mi/18833 gdb.execute ("set param value", to_string=True) will crash gdb if using MI 2015-08-18 14:02:03 -07:00
objc.exp
opencl.exp
opencl_hostapp.c
opencl_kernel.cl
pascal.exp Fix pascal behavior for class fields with testcase 2015-04-21 22:10:08 +02:00
pdtrace.in
perftest.exp Add perf testcase generator. 2015-07-24 15:43:15 -07:00
prelink-support.exp
prompt.exp
range-stepping-support.exp Remove checking vCont;s in exec_cmd_expect_vCont_count 2015-10-21 16:16:25 +01:00
read1.c
selftest-support.exp
set_unbuffered_mode.c
trace-support.exp
unbuffer_output.c Add "../lib/unbuffer_output.c" and use it in gdb.base/interrupt.c 2015-02-27 13:54:22 +00:00