From b320601b45e0642b57e8d9449bf1fa9d3f49cf87 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Thu, 24 Apr 1997 07:33:45 +0000 Subject: [PATCH] * sim-module.h, sim-model.h, sim-profile.h: New files. * sim-module.c, sim-profile.c: New files. * Make-common.in (SIM_PROFILE): Define (CONFIG_CFLAGS): Add $(SIM_PROFILE). (sim_main_headers): Add sim-module.h, sim-model.h, sim-profile.h. (sim_module.o,sim-profile.o): Add rules for. * aclocal.m4 (--enable-sim-trace): Allow symbolic arguments. (--enable-sim-profile): Add. * configure: Regenerated. * sim-base.h (sim_state_base): New members init_list, uninstall_list, model. Move trace and profile support to sim-{trace,profile}.h. New members trace_data, profile_data. * sim-basics.h: #include sim-module.h, sim-model.h, sim-profile.h. * sim-config.h: Provide default definition of WITH_PROFILE. (WITH_TRACE): Change default to -1. (MAX_NR_PROCESSORS): Always define. * sim-options.c: Move trace and profile support to sim-{trace,profile}.h. (sim_pre_argv_init): Moved to sim-model.c. (standard_install): New function. * sim-options.h (sim_pre_argv_init): Move decl to sim-model.c. (standard_install): Declare. * sim-trace.c: Tracing option handling moved here from sim-options.c. (trace_install, trace_uninstall): New functions. (trace_printf): Update reference to TRACE_FILE. * sim-trace.h (TRACE_FOO_IDX): Moved here from sim-base.h. (TRACE_foo): Bit masks for symbolic arguments to --enable-sim-trace. (WITH_TRACE_FOO_P): Define. (trace_install): Declare. (TRACE_DATA): New struct. --- sim/common/.Sanitize | 5 ++ sim/common/ChangeLog | 33 ++++++++++++ sim/common/configure | 125 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 149 insertions(+), 14 deletions(-) diff --git a/sim/common/.Sanitize b/sim/common/.Sanitize index 06fb5fcfba5..0f892b92260 100644 --- a/sim/common/.Sanitize +++ b/sim/common/.Sanitize @@ -55,11 +55,16 @@ sim-inline.h sim-io.c sim-io.h sim-load.c +sim-model.h +sim-module.c +sim-module.h sim-n-bits.h sim-n-core.h sim-n-endian.h sim-options.c sim-options.h +sim-profile.c +sim-profile.h sim-trace.c sim-trace.h sim-types.h diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index ebf1599f00d..37ebb460f46 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,36 @@ +Thu Apr 24 00:00:07 1997 Doug Evans + + * sim-module.h, sim-model.h, sim-profile.h: New files. + * sim-module.c, sim-profile.c: New files. + * Make-common.in (SIM_PROFILE): Define + (CONFIG_CFLAGS): Add $(SIM_PROFILE). + (sim_main_headers): Add sim-module.h, sim-model.h, sim-profile.h. + (sim_module.o,sim-profile.o): Add rules for. + * aclocal.m4 (--enable-sim-trace): Allow symbolic arguments. + (--enable-sim-profile): Add. + * configure: Regenerated. + * sim-base.h (sim_state_base): New members init_list, uninstall_list, + model. Move trace and profile support to sim-{trace,profile}.h. + New members trace_data, profile_data. + * sim-basics.h: #include sim-module.h, sim-model.h, sim-profile.h. + * sim-config.h: Provide default definition of WITH_PROFILE. + (WITH_TRACE): Change default to -1. + (MAX_NR_PROCESSORS): Always define. + * sim-options.c: Move trace and profile support to + sim-{trace,profile}.h. + (sim_pre_argv_init): Moved to sim-model.c. + (standard_install): New function. + * sim-options.h (sim_pre_argv_init): Move decl to sim-model.c. + (standard_install): Declare. + * sim-trace.c: Tracing option handling moved here from sim-options.c. + (trace_install, trace_uninstall): New functions. + (trace_printf): Update reference to TRACE_FILE. + * sim-trace.h (TRACE_FOO_IDX): Moved here from sim-base.h. + (TRACE_foo): Bit masks for symbolic arguments to --enable-sim-trace. + (WITH_TRACE_FOO_P): Define. + (trace_install): Declare. + (TRACE_DATA): New struct. + Wed Apr 23 17:23:15 1997 Doug Evans * run.c: Undo last exec_bfd patch. diff --git a/sim/common/configure b/sim/common/configure index 8599d84b403..19ed5bad1a7 100755 --- a/sim/common/configure +++ b/sim/common/configure @@ -21,6 +21,8 @@ ac_help="$ac_help --enable-sim-stdio Specify whether to use stdio for console input/output." ac_help="$ac_help --enable-sim-trace=opts Enable tracing flags" +ac_help="$ac_help + --enable-sim-profile=opts Enable profiling flags" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -539,13 +541,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -554,13 +556,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -794,7 +796,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -933,7 +935,9 @@ fi # Check for common headers. -for ac_hdr in stdlib.h string.h strings.h unistd.h +# FIXME: Seems to me this can cause problems for i386-windows hosts. +# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*. +for ac_hdr in stdlib.h string.h strings.h unistd.h time.h sys/time.h sys/resource.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -941,12 +945,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -970,6 +974,59 @@ else fi done +for ac_func in getrusage time +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + . ${srcdir}/../../bfd/configure.host @@ -1048,9 +1105,20 @@ fi if test "${enable_sim_trace+set}" = set; then enableval="$enable_sim_trace" case "${enableval}" in - yes) sim_trace="-DTRACE=1 -DWITH_TRACE=1";; + yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; - *) sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; + [-0-9]*) + sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; + [a-z]*) + sim_trace="" + for x in `echo "$enableval" | sed -e "s/,/ /g"`; do + if test x"$sim_trace" = x; then + sim_trace="-DWITH_TRACE='(TRACE_$x" + else + sim_trace="${sim_trace}|TRACE_$x" + fi + done + sim_trace="$sim_trace)'" ;; esac if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then echo "Setting sim trace = $sim_trace" 6>&1 @@ -1061,12 +1129,40 @@ fi +# Check whether --enable-sim-profile or --disable-sim-profile was given. +if test "${enable_sim_profile+set}" = set; then + enableval="$enable_sim_profile" + case "${enableval}" in + yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";; + no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";; + [-0-9]*) + sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";; + [a-z]*) + sim_profile="" + for x in `echo "$enableval" | sed -e "s/,/ /g"`; do + if test x"$sim_profile" = x; then + sim_profile="-DWITH_PROFILE='(PROFILE_$x" + else + sim_profile="${sim_profile}|PROFILE_$x" + fi + done + sim_profile="$sim_profile)'" ;; +esac +if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then + echo "Setting sim profile = $sim_profile" 6>&1 +fi +else + sim_profile="" +fi + + + echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1084,7 +1180,7 @@ int t() { int i; ; return 0; } EOF -if { (eval echo configure:1088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1160,12 +1256,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1335,6 +1431,7 @@ s%@sim_cflags@%$sim_cflags%g s%@sim_debug@%$sim_debug%g s%@sim_stdio@%$sim_stdio%g s%@sim_trace@%$sim_trace%g +s%@sim_profile@%$sim_profile%g s%@CPP_FOR_TARGET@%$CPP_FOR_TARGET%g s%@TARGET_SUBDIR@%$TARGET_SUBDIR%g -- 2.30.2