diff options
| author | Roland McGrath <[email protected]> | 2005-11-17 03:16:00 +0000 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2005-11-17 03:16:00 +0000 |
| commit | e47ab76f02c2a4f4d802ec298969ba67956435fe (patch) | |
| tree | 39dccb25273f15a488632c952738909f860c4b71 /tests | |
| parent | d7f8d0caa7a357f9f4765e5dc93255f5057eba2e (diff) | |
Update new test after merge.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 14 | ||||
| -rw-r--r-- | tests/Makefile.am | 10 | ||||
| -rwxr-xr-x | tests/coverage.sh | 2 | ||||
| -rw-r--r-- | tests/funcretval.c | 100 |
4 files changed, 121 insertions, 5 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index e74b639c..956955c5 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -34,12 +34,20 @@ * show-die-info.c: Likewise. * update3.c: Likewise. * update4.c: Likewise. + * funcretval.c: Likewise. * dwflmodtest.c (print_instance): Don't use INTUSE. (options): Don't use N_ macro. 2005-11-15 Roland McGrath <[email protected]> + * coverage.sh: Look in backends. + * Makefile.am (BUILD_RPATH): Search ../backends, not ../libebl. + (TESTS_ENVIRONMENT): Likewise. + + * funcretval.c (handle_function): Don't take DW_AT_type of FUNCDIE, + pass FUNCDIE direclty to dwfl_module_return_value_location. + * Makefile.am (BUILD_RPATH): New variable. [TESTS_RPATH] (AM_LDFLAGS): Pass -rpath option using that value. (tests_rpath): New variable. @@ -79,6 +87,12 @@ * run-strings-test.sh: Likewise. * run-strip-test.sh: Likewise. +2005-11-13 Roland McGrath <[email protected]> + + * funcretval.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (funcretval_LDADD): New variable. + 2005-11-09 Ulrich Drepper <[email protected]> * line2addr.c (handle_module): Add missing parameter to printf. diff --git a/tests/Makefile.am b/tests/Makefile.am index 98e6f035..8cc73284 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,11 +16,11 @@ DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE if MUDFLAP AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 -fmudflap\ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) -BUILD_RPATH = \$$ORIGIN/../libebl +BUILD_RPATH = \$$ORIGIN/../backends else AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) -BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf +BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf endif if !STANDALONE @@ -41,7 +41,8 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ showptable update1 update2 update3 update4 test-nlist \ show-die-info get-files get-lines get-pubnames \ get-aranges allfcts line2addr addrscopes funcscopes \ - show-abbrev hash newscn ecp dwflmodtest find-prologues + show-abbrev hash newscn ecp dwflmodtest \ + find-prologues funcretval # get-ciefde asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ asm-tst6 asm-tst7 asm-tst8 asm-tst9 @@ -102,7 +103,7 @@ if STANDALONE TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT) else !STANDALONE TESTS_ENVIRONMENT = $(srcdir)/test-wrapper.sh \ - ../libdw:../libebl:../libelf:../libasm + ../libdw:../backends:../libelf:../libasm installcheck-local: $(MAKE) $(AM_MAKEFLAGS) \ @@ -159,6 +160,7 @@ line2addr_no_Wformat = yes line2addr_LDADD = $(libdw) $(libmudflap) addrscopes_LDADD = $(libdw) $(libmudflap) funcscopes_LDADD = $(libdw) $(libmudflap) +funcretval_LDADD = $(libdw) $(libmudflap) find_prologues_LDADD = $(libdw) $(libmudflap) #show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap) asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl diff --git a/tests/coverage.sh b/tests/coverage.sh index f09f644f..288ee990 100755 --- a/tests/coverage.sh +++ b/tests/coverage.sh @@ -2,7 +2,7 @@ cd .. -for d in lib libasm libdw libdwfl libebl libelf src; do +for d in lib libasm libdw libdwfl libebl libelf backends src; do tmp=$d-data cd $d unused=0 diff --git a/tests/funcretval.c b/tests/funcretval.c new file mode 100644 index 00000000..66e04f6b --- /dev/null +++ b/tests/funcretval.c @@ -0,0 +1,100 @@ +/* Test program for dwfl_module_return_value_location. + Copyright (C) 2005 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> +#include <argp.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <stdlib.h> +#include <error.h> +#include <string.h> +#include <fnmatch.h> + + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Die *funcdie, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (funcdie); + char **argv = a->argv; + if (argv[0] != NULL) + { + bool match; + do + match = fnmatch (*argv, name, 0) == 0; + while (!match && *++argv); + if (!match) + return 0; + } + + printf ("(%s) %s: ", dwfl_module_info (dwfl_cumodule (a->cu), NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL), name); + + const Dwarf_Op *locops; + int nlocops = dwfl_module_return_value_location (dwfl_cumodule (a->cu), + funcdie, &locops); + if (nlocops < 0) + error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s", + dwfl_errmsg (-1)); + else if (nlocops == 0) + puts ("returns no value"); + else + { + printf ("return value location:"); + for (int i = 0; i < nlocops; ++i) + printf (" {%#x, %#" PRIx64 "}", locops[i].atom, locops[i].number); + puts (""); + } + + return 0; +} + + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct args a = { .dwfl = NULL, .cu = NULL }; + + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, + &a.dwfl); + assert (a.dwfl != NULL); + a.argv = &argv[remaining]; + + int result = 0; + + while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL) + dwarf_getfuncs (a.cu, &handle_function, &a, 0); + + return result; +} |
