From 6c310da826b31a1ce75469b0c402a75dafbf19b1 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Sat, 4 Jan 1997 00:25:53 +0000 Subject: [PATCH] * Makefile.in configure configure.in: Remove ENABLE_CLIBS, ENABLE_OBS, and THREAD_DB_OBS. These are consolidated into LIBS and CONFIG_OBS. * configure configure.in: Clean up test cases around thread support. start-sanitize-v850 * configure.tgt (v850-*-*): Include v850ice.o and v850.lib if host is Windows. end-sanitize-v850 * c-valprint.c ch-valprint.c cp-valprint.c eval.c expprint.c printcmd.c valops.c value.h values.c: Add bfd_section arg to value_at and value_at_lazy. * coffread.c dbxread.c elfread.c mdebugread.c minsyms.c symtab.h: Add bfd_section arg to prim_record_minimal_symbol_and_info. * corefile.c gdbcore.h printcmd.c valops.c: Use read_memory_section instead of read_memory. It takes a bfd_section arg. * coffread.c dbxread.c elfread.c gdb-stabs.h objfiles.h: Remove unnecessary cast for assignment of struct dbx_symfile_info. Struct objfile now uses a real pointer instead of PTR for this element. * dbxread.c (dbx_symfile_init): Stash bfd section pointers for text, data and bss into dbx_symfile_info. * exec.c (xfer_memory): Handle transfers for user-specified sections. * findvar.c (read_var_value locate_var_value): Copy bfd section from the symbol to the value. * gdb-stabs.h: Add section pointers for text, data and bss sections. * maint.c (translate address command): Add test code for overlay address translation. * printcmd.c (do_examine do_one_display): Now takes a bfd section arg. * (print_formatted x_command): Record current section along with current address for repeated commands. * sparc-nat.c (fetch_inferior_registers): Change target_xfer_memory to target_{read write}_memory to allow changes to target_xfer_memory interface for section info. * symmisc.c (dump_msymbols print_symbol): Print section assocaited with symbol. * symtab.c (fixup_symbol_section): New routine to add section info to symbols returned by lookup_symbol. * symtab.h (struct general_symbol_info): Add bfd section to symbols. * target.c target.h (target_xfer_memory): Add bfd section to args. * (target_read_memory_section): New routine to read data from a specific section. * (target_memory_bfd_section): New global variable to pass bfd section in to targets. * valarith.c (value_add value_addr value_array): Preserve bfd section when computing new value. * value.h (struct value): Add bfd section to values. * values.c (allocate_value value_copy): Initialize/preserve bfd section. * (unpack_double): Clean up _MSC_VER conditionals to remove duplicate code. start-sanitize-v850 * v850ice.c: New module to support communication with NEC's PC-based ICE. * config/v850/tm-v850.h (REGISTER_NAMES): Replace sp, gp, fp, and ep names with rxx names. sp and fp are renamed via a different mechanism. end-sanitize-v850 --- gdb/.Sanitize | 2 +- gdb/ChangeLog | 65 +++++++ gdb/c-valprint.c | 5 +- gdb/ch-valprint.c | 3 +- gdb/configure | 146 ++++++++-------- gdb/configure.in | 45 ++--- gdb/configure.tgt | 9 +- gdb/corefile.c | 13 ++ gdb/cp-valprint.c | 3 +- gdb/elfread.c | 20 +-- gdb/mdebugread.c | 8 +- gdb/minsyms.c | 6 +- gdb/v850ice.c | 504 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/values.c | 10 +- 14 files changed, 717 insertions(+), 122 deletions(-) create mode 100755 gdb/v850ice.c diff --git a/gdb/.Sanitize b/gdb/.Sanitize index 5c697c4..b956f64 100644 --- a/gdb/.Sanitize +++ b/gdb/.Sanitize @@ -88,7 +88,7 @@ else fi fi -v850_files="v850-tdep.c" +v850_files="v850ice.c v850-tdep.c" if ( echo $* | grep keep\-v850 > /dev/null ) ; then keep_these_too="${v850_files} ${keep_these_too}" diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1ef42e7..736d8a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,68 @@ +Fri Jan 3 12:08:16 1997 Stu Grossman (grossman@critters.cygnus.com) + + * Makefile.in configure configure.in: Remove ENABLE_CLIBS, + ENABLE_OBS, and THREAD_DB_OBS. These are consolidated into LIBS + and CONFIG_OBS. + * configure configure.in: Clean up test cases around thread support. +start-sanitize-v850 + * configure.tgt (v850-*-*): Include v850ice.o and v850.lib if + host is Windows. +end-sanitize-v850 + * c-valprint.c ch-valprint.c cp-valprint.c eval.c expprint.c + printcmd.c valops.c value.h values.c: Add bfd_section arg to + value_at and value_at_lazy. + * coffread.c dbxread.c elfread.c mdebugread.c minsyms.c symtab.h: + Add bfd_section arg to prim_record_minimal_symbol_and_info. + * corefile.c gdbcore.h printcmd.c valops.c: Use read_memory_section + instead of read_memory. It takes a bfd_section arg. + * coffread.c dbxread.c elfread.c gdb-stabs.h objfiles.h: Remove + unnecessary cast for assignment of struct dbx_symfile_info. + Struct objfile now uses a real pointer instead of PTR for this + element. + * dbxread.c (dbx_symfile_init): Stash bfd section pointers for + text, data and bss into dbx_symfile_info. + * exec.c (xfer_memory): Handle transfers for user-specified + sections. + * findvar.c (read_var_value locate_var_value): Copy bfd section + from the symbol to the value. + * gdb-stabs.h: Add section pointers for text, data and bss + sections. + * maint.c (translate address command): Add test code for overlay + address translation. + * printcmd.c (do_examine do_one_display): Now takes a bfd section + arg. + * (print_formatted x_command): Record current section along with + current address for repeated commands. + * sparc-nat.c (fetch_inferior_registers): Change + target_xfer_memory to target_{read write}_memory to allow changes + to target_xfer_memory interface for section info. + * symmisc.c (dump_msymbols print_symbol): Print section + assocaited with symbol. + * symtab.c (fixup_symbol_section): New routine to + add section info to symbols returned by lookup_symbol. + * symtab.h (struct general_symbol_info): Add bfd section to + symbols. + * target.c target.h (target_xfer_memory): Add bfd section to + args. + * (target_read_memory_section): New routine to read data from a + specific section. + * (target_memory_bfd_section): New global variable to pass bfd + section in to targets. + * valarith.c (value_add value_addr value_array): Preserve bfd + section when computing new value. + * value.h (struct value): Add bfd section to values. + * values.c (allocate_value value_copy): Initialize/preserve bfd + section. + * (unpack_double): Clean up _MSC_VER conditionals to remove + duplicate code. +start-sanitize-v850 + * v850ice.c: New module to support communication with NEC's + PC-based ICE. + * config/v850/tm-v850.h (REGISTER_NAMES): Replace sp, gp, fp, and + ep names with rxx names. sp and fp are renamed via a different + mechanism. +end-sanitize-v850 + Fri Jan 3 14:20:05 1997 Geoffrey Noer * mn10300-tdep.c (mn10300_push_arguments): rewrote diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 4850180..7901a5f 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -211,7 +211,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse, { wtype = TYPE_TARGET_TYPE(type); } - vt_val = value_at (wtype, vt_address); + vt_val = value_at (wtype, vt_address, NULL); val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), VALUE_ADDRESS (vt_val), stream, format, deref_ref, recurse + 1, pretty); @@ -261,7 +261,8 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse, value_at (TYPE_TARGET_TYPE (type), unpack_pointer (lookup_pointer_type (builtin_type_void), - valaddr)); + valaddr), + NULL); val_print (VALUE_TYPE (deref_val), VALUE_CONTENTS (deref_val), VALUE_ADDRESS (deref_val), stream, format, diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c index fcc821f..796172f 100644 --- a/gdb/ch-valprint.c +++ b/gdb/ch-valprint.c @@ -459,7 +459,8 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, value_at (TYPE_TARGET_TYPE (type), unpack_pointer (lookup_pointer_type (builtin_type_void), - valaddr)); + valaddr), + NULL); val_print (VALUE_TYPE (deref_val), VALUE_CONTENTS (deref_val), VALUE_ADDRESS (deref_val), stream, format, diff --git a/gdb/configure b/gdb/configure index 8833778..82781c1 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1575,6 +1575,9 @@ fi done + +CONFIG_OBS= + # If we are configured native on Linux, work around problems with sys/procfs.h if test "${target}" = "${host}"; then case "${host}" in @@ -1592,19 +1595,19 @@ EOF fi echo $ac_n "checking for gregset_t type""... $ac_c" 1>&6 -echo "configure:1596: checking for gregset_t type" >&5 +echo "configure:1599: checking for gregset_t type" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { gregset_t *gregsetp = 0 ; return 0; } EOF -if { (eval echo configure:1608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* gdb_cv_have_gregset_t=yes else @@ -1625,19 +1628,19 @@ EOF fi echo $ac_n "checking for fpregset_t type""... $ac_c" 1>&6 -echo "configure:1629: checking for fpregset_t type" >&5 +echo "configure:1632: checking for fpregset_t type" >&5 if eval "test \"`echo '$''{'gdb_cv_have_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { fpregset_t *fpregsetp = 0 ; return 0; } EOF -if { (eval echo configure:1641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* gdb_cv_have_fpregset_t=yes else @@ -1659,12 +1662,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:1663: checking for long long support in compiler" >&5 +echo "configure:1666: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -1696,7 +1699,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:1700: checking for long long support in printf" >&5 +echo "configure:1703: checking for long long support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1704,7 +1707,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_long=yes else @@ -1738,19 +1741,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6 -echo "configure:1742: checking for long double support in compiler" >&5 +echo "configure:1745: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -1772,7 +1775,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:1776: checking for long double support in printf" >&5 +echo "configure:1779: checking for long double support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1780,7 +1783,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_double=yes else @@ -1816,17 +1819,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1820: checking for $ac_hdr" >&5 +echo "configure:1823: checking for $ac_hdr" >&5 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:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1855,12 +1858,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1859: checking for $ac_func" >&5 +echo "configure:1862: checking for $ac_func" >&5 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1908,7 +1911,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1912: checking for working mmap" >&5 +echo "configure:1915: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1916,7 +1919,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -2080,12 +2083,12 @@ fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:2084: checking whether malloc must be declared" >&5 +echo "configure:2087: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2106,7 +2109,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:2110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -2128,12 +2131,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:2132: checking whether realloc must be declared" >&5 +echo "configure:2135: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2154,7 +2157,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:2158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -2176,12 +2179,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:2180: checking whether free must be declared" >&5 +echo "configure:2183: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2202,7 +2205,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:2206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -2227,42 +2230,41 @@ fi if test ${build} = ${host} -a ${host} = ${target} ; then - echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:2232: checking for Solaris thread debugging library" >&5 - if test -f /usr/lib/libthread_db.so.1 ; then - echo "$ac_t""yes" 1>&6 - THREAD_DB_OBS=sol-thread.o - cat >> confdefs.h <<\EOF -#define HAVE_THREAD_DB_LIB 1 -EOF - - CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic" - else - echo "$ac_t""no" 1>&6 - fi case ${host_os} in hpux*) echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6 -echo "configure:2247: checking for HPUX/OSF thread support" >&5 +echo "configure:2237: checking for HPUX/OSF thread support" >&5 if test -f /usr/include/dce/cma_config.h ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_HPUX_THREAD_SUPPORT 1 EOF - THREAD_DB_OBS=hpux-thread.o + CONFIG_OBS="${CONFIG_OJS} hpux-thread.o" + else + echo "$ac_t""no" 1>&6 + fi + ;; + solaris*) + echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 +echo "configure:2251: checking for Solaris thread debugging library" >&5 + if test -f /usr/lib/libthread_db.so.1 ; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_THREAD_DB_LIB 1 +EOF + + CONFIG_OBS="${CONFIG_OBS} sol-thread.o" + CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic" else echo "$ac_t""no" 1>&6 fi ;; esac - fi ENABLE_CFLAGS= -ENABLE_CLIBS= -ENABLE_OBS= # Check whether --enable-netrom or --disable-netrom was given. if test "${enable_netrom+set}" = set; then @@ -2276,7 +2278,7 @@ fi if test "${enable_netrom}" = "yes"; then - ENABLE_OBS="${ENABLE_OBS} remote-nrom.o" + CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" fi # start-sanitize-gm @@ -2286,7 +2288,7 @@ ENABLE_GM= if test "${enable_gm+set}" = set; then enableval="$enable_gm" case "${enableval}" in -yes) ENABLE_OBS="${ENABLE_OBS} gmagic.o" +yes) CONFIG_OBS="${CONFIG_OBS} gmagic.o" ENABLE_CFLAGS=-DGENERAL_MAGIC ;; no) ;; @@ -2365,7 +2367,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:2369: checking for Tcl configuration" >&5 +echo "configure:2371: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2473,7 +2475,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:2477: checking for Tk configuration" >&5 +echo "configure:2479: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2567,7 +2569,7 @@ fi # no_tcl=true echo $ac_n "checking for Tcl private headers""... $ac_c" 1>&6 -echo "configure:2571: checking for Tcl private headers" >&5 +echo "configure:2573: checking for Tcl private headers" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -2633,17 +2635,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:2637: checking for tclInt.h" >&5 +echo "configure:2639: checking for tclInt.h" >&5 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:2647: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2703,7 +2705,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:2707: checking for Tk private headers" >&5 +echo "configure:2709: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -2769,17 +2771,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:2773: checking for tk.h" >&5 +echo "configure:2775: checking for tk.h" >&5 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:2783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2824,14 +2826,12 @@ fi - # Include some libraries that Tcl and Tk want. - LIBS="$LIBS $TK_LIBS" - ENABLE_GDBTK=1 + # Include some libraries that Tcl and Tk want. TCL_LIBS='$(TCL) $(TK) $(X11_LDFLAGS) $(X11_LIBS)' - ENABLE_CLIBS="${ENABLE_CLIBS} ${TCL_LIBS}" - ENABLE_OBS="${ENABLE_OBS} gdbtk.o" + LIBS="${LIBS} ${TCL_LIBS} ${TK_LIBS}" + CONFIG_OBS="${CONFIG_OBS} gdbtk.o" fi fi fi @@ -3156,7 +3156,6 @@ s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g s%@YACC@%$YACC%g s%@AWK@%$AWK%g -s%@THREAD_DB_OBS@%$THREAD_DB_OBS%g s%@CONFIG_LDFLAGS@%$CONFIG_LDFLAGS%g s%@TCL_VERSION@%$TCL_VERSION%g s%@TCL_MAJOR_VERSION@%$TCL_MAJOR_VERSION%g @@ -3188,8 +3187,7 @@ s%@X_CFLAGS@%$X_CFLAGS%g s%@X_LDFLAGS@%$X_LDFLAGS%g s%@X_LIBS@%$X_LIBS%g s%@ENABLE_CFLAGS@%$ENABLE_CFLAGS%g -s%@ENABLE_CLIBS@%$ENABLE_CLIBS%g -s%@ENABLE_OBS@%$ENABLE_OBS%g +s%@CONFIG_OBS@%$CONFIG_OBS%g s%@HLDFLAGS@%$HLDFLAGS%g s%@HLDENV@%$HLDENV%g s%@target_subdir@%$target_subdir%g diff --git a/gdb/configure.in b/gdb/configure.in index 7c65340..7089267 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -47,6 +47,10 @@ AC_C_CONST AC_CHECK_FUNCS(setpgid sbrk select poll) +dnl List of object files added by configuire. + +CONFIG_OBS= + # If we are configured native on Linux, work around problems with sys/procfs.h if test "${target}" = "${host}"; then case "${host}" in @@ -154,35 +158,34 @@ dnl Note that we only want this if we are both native (host == target), and dnl not doing a canadian cross build (build == host). if test ${build} = ${host} -a ${host} = ${target} ; then - AC_MSG_CHECKING(for Solaris thread debugging library) - if test -f /usr/lib/libthread_db.so.1 ; then - AC_MSG_RESULT(yes) - THREAD_DB_OBS=sol-thread.o - AC_DEFINE(HAVE_THREAD_DB_LIB) - CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic" - else - AC_MSG_RESULT(no) - fi case ${host_os} in hpux*) AC_MSG_CHECKING(for HPUX/OSF thread support) if test -f /usr/include/dce/cma_config.h ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT) - THREAD_DB_OBS=hpux-thread.o + CONFIG_OBS="${CONFIG_OJS} hpux-thread.o" + else + AC_MSG_RESULT(no) + fi + ;; + solaris*) + AC_MSG_CHECKING(for Solaris thread debugging library) + if test -f /usr/lib/libthread_db.so.1 ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_THREAD_DB_LIB) + CONFIG_OBS="${CONFIG_OBS} sol-thread.o" + CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic" else AC_MSG_RESULT(no) fi ;; esac - AC_SUBST(THREAD_DB_OBS) AC_SUBST(CONFIG_LDFLAGS) fi dnl Handle optional features that can be enabled. ENABLE_CFLAGS= -ENABLE_CLIBS= -ENABLE_OBS= AC_ARG_ENABLE(netrom, [ --enable-netrom ], @@ -193,7 +196,7 @@ no) enable_netrom=no ;; esac]) if test "${enable_netrom}" = "yes"; then - ENABLE_OBS="${ENABLE_OBS} remote-nrom.o" + CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" fi # start-sanitize-gm @@ -202,7 +205,7 @@ ENABLE_GM= AC_ARG_ENABLE(gm, [ --enable-gm ], [case "${enableval}" in -yes) ENABLE_OBS="${ENABLE_OBS} gmagic.o" +yes) CONFIG_OBS="${CONFIG_OBS} gmagic.o" ENABLE_CFLAGS=-DGENERAL_MAGIC ;; no) ;; @@ -265,14 +268,12 @@ if test "${enable_gdbtk}" = "yes"; then CY_AC_PATH_TCLH CY_AC_PATH_TKH - # Include some libraries that Tcl and Tk want. - LIBS="$LIBS $TK_LIBS" - ENABLE_GDBTK=1 + # Include some libraries that Tcl and Tk want. TCL_LIBS='$(TCL) $(TK) $(X11_LDFLAGS) $(X11_LIBS)' - ENABLE_CLIBS="${ENABLE_CLIBS} ${TCL_LIBS}" - ENABLE_OBS="${ENABLE_OBS} gdbtk.o" + LIBS="${LIBS} ${TCL_LIBS} ${TK_LIBS}" + CONFIG_OBS="${CONFIG_OBS} gdbtk.o" fi fi fi @@ -284,8 +285,8 @@ AC_SUBST(X_LIBS) # end-sanitize-gdbtk AC_SUBST(ENABLE_CFLAGS) -AC_SUBST(ENABLE_CLIBS) -AC_SUBST(ENABLE_OBS) + +AC_SUBST(CONFIG_OBS) # Begin stuff to support --enable-shared AC_ARG_ENABLE(shared, diff --git a/gdb/configure.tgt b/gdb/configure.tgt index e03717d..64961f4 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -249,8 +249,13 @@ tahoe-*-*) gdb_target=tahoe ;; vax-*-*) gdb_target=vax ;; # start-sanitize-v850 -v850-*-*) gdb_target=v850 ;; - +v850-*-*) gdb_target=v850 + case $gdb_host in + windows) + CONFIG_OBS="${CONFIG_OBS} v850ice.o" + LIBS="${LIBS} v850.lib" ;; + esac + ;; # end-sanitize-v850 w65-*-*) gdb_target=w65 ;; diff --git a/gdb/corefile.c b/gdb/corefile.c index 6581420..ddaee62 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -225,6 +225,19 @@ read_memory (memaddr, myaddr, len) memory_error (status, memaddr); } +void +read_memory_section (memaddr, myaddr, len, bfd_section) + CORE_ADDR memaddr; + char *myaddr; + int len; + asection *bfd_section; +{ + int status; + status = target_read_memory_section (memaddr, myaddr, len, bfd_section); + if (status != 0) + memory_error (status, memaddr); +} + /* Like target_read_memory, but slightly different parameters. */ int diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 5cac8d5..b43da16 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -342,7 +342,8 @@ cp_print_value_fields (type, valaddr, address, stream, format, recurse, pretty, else { v = value_at (TYPE_FIELD_TYPE (type, i), - SYMBOL_VALUE_ADDRESS (sym)); + SYMBOL_VALUE_ADDRESS (sym), + NULL); cp_print_static_field (TYPE_FIELD_TYPE (type, i), v, stream, format, recurse + 1, pretty); diff --git a/gdb/elfread.c b/gdb/elfread.c index 524df4a..b96fa17 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -81,6 +81,7 @@ free_elfinfo PARAMS ((void *)); static struct minimal_symbol * record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type, char *, + asection *bfd_section, struct objfile *)); static void @@ -169,11 +170,13 @@ elf_interpreter (abfd) #endif static struct minimal_symbol * -record_minimal_symbol_and_info (name, address, ms_type, info, objfile) +record_minimal_symbol_and_info (name, address, ms_type, info, bfd_section, + objfile) char *name; CORE_ADDR address; enum minimal_symbol_type ms_type; char *info; /* FIXME, is this really char *? */ + asection *bfd_section; struct objfile *objfile; { int section; @@ -203,7 +206,7 @@ record_minimal_symbol_and_info (name, address, ms_type, info, objfile) } return prim_record_minimal_symbol_and_info - (name, address, ms_type, info, section, objfile); + (name, address, ms_type, info, section, bfd_section, objfile); } /* @@ -258,8 +261,7 @@ elf_symtab_read (abfd, addr, objfile, dynamic) /* Name of filesym, as saved on the symbol_obstack. */ char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack); #endif - struct dbx_symfile_info *dbx = (struct dbx_symfile_info *) - objfile->sym_stab_info; + struct dbx_symfile_info *dbx = objfile->sym_stab_info; unsigned long size; int stripped = (bfd_get_symcount (abfd) == 0); @@ -320,7 +322,7 @@ elf_symtab_read (abfd, addr, objfile, dynamic) symaddr += addr; msym = record_minimal_symbol_and_info ((char *) sym -> name, symaddr, - mst_solib_trampoline, NULL, objfile); + mst_solib_trampoline, NULL, sym -> section, objfile); #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; @@ -531,7 +533,7 @@ elf_symtab_read (abfd, addr, objfile, dynamic) size = ((elf_symbol_type *) sym) -> internal_elf_sym.st_size; msym = record_minimal_symbol_and_info ((char *) sym -> name, symaddr, - ms_type, (PTR) size, objfile); + ms_type, (PTR) size, sym -> section, objfile); #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; @@ -671,8 +673,7 @@ free_elfinfo (objp) PTR objp; { struct objfile *objfile = (struct objfile *)objp; - struct dbx_symfile_info *dbxinfo = (struct dbx_symfile_info *) - objfile->sym_stab_info; + struct dbx_symfile_info *dbxinfo = objfile->sym_stab_info; struct stab_section_info *ssi, *nssi; ssi = dbxinfo->stab_section_info; @@ -749,8 +750,7 @@ elfstab_offset_sections (objfile, pst) struct partial_symtab *pst; { char *filename = pst->filename; - struct dbx_symfile_info *dbx = (struct dbx_symfile_info *) - objfile->sym_stab_info; + struct dbx_symfile_info *dbx = objfile->sym_stab_info; struct stab_section_info *maybe = dbx->stab_section_info; struct stab_section_info *questionable = 0; int i; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 17e02c6..8047798 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -2586,6 +2586,7 @@ parse_partial_symbols (objfile, section_offsets) mst_file_text, NULL, SECT_OFF_TEXT, + NULL, objfile); } procaddr = sh.value; @@ -2633,6 +2634,7 @@ parse_partial_symbols (objfile, section_offsets) mst_file_data, NULL, SECT_OFF_DATA, + NULL, objfile); break; @@ -2644,6 +2646,7 @@ parse_partial_symbols (objfile, section_offsets) mst_file_bss, NULL, SECT_OFF_BSS, + NULL, objfile); break; } @@ -2725,7 +2728,8 @@ parse_partial_symbols (objfile, section_offsets) case stStaticProc: prim_record_minimal_symbol_and_info (name, sh.value, mst_file_text, NULL, - SECT_OFF_TEXT, objfile); + SECT_OFF_TEXT, NULL, + objfile); /* FALLTHROUGH */ @@ -2802,11 +2806,13 @@ parse_partial_symbols (objfile, section_offsets) prim_record_minimal_symbol_and_info (name, sh.value, mst_file_data, NULL, SECT_OFF_DATA, + NULL, objfile); else prim_record_minimal_symbol_and_info (name, sh.value, mst_file_bss, NULL, SECT_OFF_BSS, + NULL, objfile); class = LOC_STATIC; break; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 608ae70..174c3ed 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -500,7 +500,7 @@ prim_record_minimal_symbol (name, address, ms_type, objfile) } prim_record_minimal_symbol_and_info (name, address, ms_type, - NULL, section, objfile); + NULL, section, NULL, objfile); } /* Record a minimal symbol in the msym bunches. Returns the symbol @@ -508,12 +508,13 @@ prim_record_minimal_symbol (name, address, ms_type, objfile) struct minimal_symbol * prim_record_minimal_symbol_and_info (name, address, ms_type, info, section, - objfile) + bfd_section, objfile) const char *name; CORE_ADDR address; enum minimal_symbol_type ms_type; char *info; int section; + asection *bfd_section; struct objfile *objfile; { register struct msym_bunch *new; @@ -553,6 +554,7 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section, SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown); SYMBOL_VALUE_ADDRESS (msymbol) = address; SYMBOL_SECTION (msymbol) = section; + SYMBOL_BFD_SECTION (msymbol) = bfd_section; MSYMBOL_TYPE (msymbol) = ms_type; /* FIXME: This info, if it remains, needs its own field. */ diff --git a/gdb/v850ice.c b/gdb/v850ice.c new file mode 100755 index 0000000..d3e1b19 --- /dev/null +++ b/gdb/v850ice.c @@ -0,0 +1,504 @@ +/* ICE interface for the NEC V850 for GDB, the GNU debugger. + Copyright 1996, Free Software Foundation, Inc. + +This file is part of GDB. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "gdb_string.h" +#if 0 +#include "frame.h" +#endif +#include "inferior.h" +#if 0 +#include "bfd.h" +#endif +#include "symfile.h" +#include "target.h" +#if 0 +#include "wait.h" +#include "gdbcmd.h" +#include "objfiles.h" +#include "gdb-stabs.h" +#include "gdbthread.h" +#endif + +/* Prototypes for local functions */ + +static void v850ice_files_info PARAMS ((struct target_ops *ignore)); + +static int v850ice_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, + int len, int should_write, + struct target_ops *target)); + +static void v850ice_prepare_to_store PARAMS ((void)); + +static void v850ice_fetch_registers PARAMS ((int regno)); + +static void v850ice_resume PARAMS ((int pid, int step, + enum target_signal siggnal)); + +static void v850ice_open PARAMS ((char *name, int from_tty)); + +static void v850ice_close PARAMS ((int quitting)); + +static void v850ice_store_registers PARAMS ((int regno)); + +static void v850ice_mourn PARAMS ((void)); + +static int v850ice_wait PARAMS ((int pid, struct target_waitstatus *status)); + +static void v850ice_kill PARAMS ((void)); + +static void v850ice_detach PARAMS ((char *args, int from_tty)); + +static int v850ice_insert_breakpoint PARAMS ((CORE_ADDR, char *)); + +static int v850ice_remove_breakpoint PARAMS ((CORE_ADDR, char *)); + +static int ice_open = 0; + +#ifndef EXPORT +#define EXPORT __declspec(dllexport) +#endif + +EXPORT long __stdcall ExeAppReq (char *, long, char *, char *); + +#define MREADREG 0x0001 +#define MWRITEREG 0x0002 +#define MREADMEM 0x0003 +#define MWRITEMEM 0x0004 +#define MSINGLESTEP 0x0005 +#define MRESUME 0x0006 +#define MLOADPROGRAM 0x0007 +#define MSETBREAK 0x0008 +#define MREMOVEBREAK 0x0009 +#define MQUIT 0x000A +#define MTERMINATE 0x000B +#define MATTACH 0x000C +#define MCHECKSTATUS 0x000D +#define MHALT 0x000E +#define MDIRECTCMD 0x000F +#define MSYMADR 0x0010 +#define MGETTASKLIST 0x0011 +#define MREADVECREG 0x0012 +#define MWRITEVECREG 0x0013 +#define MGETCHANGEDREGS 0x0014 +#define MGETSERVERINFO 0x0015 +#define MREADBLOCK 0x0016 +#define MSETHARDBRK 0x0017 +#define MREMOVEHARDBRK 0x0018 +#define MCOPYBLOCK 0x0019 +#define MBLOCKFILL 0x001A +#define MFINDBLOCK 0x001B +#define MCOMPAREBLOCK 0x001C +#define MREFRESH 0x001D +#define MSPECIAL 0x001E +#define MGETCMDLIST 0x001F +#define MEXPVAL 0x0020 +#define MEXPFAILED 0x0021 +#define MSAVESTATE 0x0022 +#define MWRITEBLOCK 0x0023 +#define MDETACH 0x0024 +#define MGETMODULES 0x0025 +#define MREMOTESYMBOL 0x0026 +#define MREADCSTRING 0x0027 +#define MLOADMODULE 0x0028 +#define MDIDSYSCALL 0x0029 +#define MDBPWRITEBUFFERS 0x002A +#define MBPID 0x002B +#define MINITEXEC 0x002C +#define MEXITEXEC 0x002D +#define MRCCMD 0x002E +#define MDOWNLOAD 0x0050 + +extern struct target_ops v850ice_ops; /* Forward decl */ + +/* "pir", "tkcw", "chcw", "adtre" */ + +/* Code for opening a connection to the ICE. */ + +static void +v850ice_open (name, from_tty) + char *name; + int from_tty; +{ + long retval; + char retmsg[1000]; + + if (name) + error ("Too many arguments."); + + target_preopen (from_tty); + + unpush_target (&v850ice_ops); + + if (from_tty) + puts_filtered ("V850ice debugging\n"); + + push_target (&v850ice_ops); /* Switch to using v850ice target now */ + + target_terminal_init (); + + /* Without this, some commands which require an active target (such as kill) + won't work. This variable serves (at least) double duty as both the pid + of the target process (if it has such), and as a flag indicating that a + target is active. These functions should be split out into seperate + variables, especially since GDB will someday have a notion of debugging + several processes. */ + + inferior_pid = 42000; + + /* Start the v850ice connection; if error (0), discard this target. + In particular, if the user quits, be sure to discard it + (we'd be in an inconsistent state otherwise). */ + + retval = ExeAppReq ("GDB", MINITEXEC, "0", retmsg); + ice_open = 1; + + start_remote (); + +/* pop_target();*/ +} + +/* Clean up connection to a remote debugger. */ + +/* ARGSUSED */ +static void +v850ice_close (quitting) + int quitting; +{ + long retval; + + if (ice_open) + { + retval = ExeAppReq ("GDB", MEXITEXEC, NULL, NULL); + if (retval) + error ("ExeAppReq (MEXITEXEC) returned %d", retval); + ice_open = 0; + } +} + +static void +v850ice_detach (args, from_tty) + char *args; + int from_tty; +{ + if (args) + error ("Argument given to \"detach\" when remotely debugging."); + + pop_target (); + if (from_tty) + puts_filtered ("Ending v850ice debugging.\n"); +} + +/* Tell the remote machine to resume. */ + +static void +v850ice_resume (pid, step, siggnal) + int pid, step; + enum target_signal siggnal; +{ + long retval; + char cmd[100]; + char val[100]; + + if (step) + retval = ExeAppReq ("GDB", MSINGLESTEP, "step", val); + else + retval = ExeAppReq ("GDB", MRESUME, "run", val); + + if (retval) + error ("ExeAppReq (step = %d) returned %d: cmd = %s", step, retval, cmd); +} + +/* Wait until the remote machine stops, then return, + storing status in STATUS just as `wait' would. + Returns "pid" (though it's not clear what, if anything, that + means in the case of this target). */ + +static int +v850ice_wait (pid, status) + int pid; + struct target_waitstatus *status; +{ + status->kind = TARGET_WAITKIND_STOPPED; + status->value.sig = TARGET_SIGNAL_TRAP; + + return inferior_pid; +} + +static int +convert_register (regno, buf) + int regno; + char *buf; +{ + if (regno <= 31) + sprintf (buf, "r%d", regno); + else if (reg_names[regno][0] == 's' + && reg_names[regno][1] == 'r') + return 0; + else + sprintf (buf, "%s", reg_names[regno]); + + return 1; +} + +/* Read the remote registers into the block REGS. */ +/* Note that the ICE returns register contents as ascii hex strings. We have + to convert that to an unsigned long, and then call store_unsigned_integer to + convert it to target byte-order if necessary. */ + +static void +v850ice_fetch_registers (regno) + int regno; +{ + long retval; + char cmd[100]; + char val[100]; + unsigned long regval; + char *p; + + if (regno == -1) + { + for (regno = 0; regno < NUM_REGS; regno++) + v850ice_fetch_registers (regno); + return; + } + + strcpy (cmd, "reg "); + if (!convert_register (regno, &cmd[4])) + return; + + retval = ExeAppReq ("GDB", MREADREG, cmd, val); + if (retval) + error ("ExeAppReq returned %d: cmd = %s", retval, cmd); + + regval = strtoul (val, &p, 16); + if (regval == 0 && p == val) + error ("v850ice_fetch_registers (%d): bad value from ICE: %s.", + regno, val); + + store_unsigned_integer (val, REGISTER_RAW_SIZE (regno), regval); + supply_register (regno, val); +} + +/* Store register REGNO, or all registers if REGNO == -1, from the contents + of REGISTERS. */ + +static void +v850ice_store_registers (regno) + int regno; +{ + long retval; + char cmd[100]; + char val[100]; + unsigned long regval; + + if (regno == -1) + { + for (regno = 0; regno < NUM_REGS; regno++) + v850ice_store_registers (regno); + return; + } + + regval = extract_unsigned_integer (®isters[REGISTER_BYTE (regno)], + REGISTER_RAW_SIZE (regno)); + strcpy (cmd, "reg "); + if (!convert_register (regno, &cmd[4])) + return; + sprintf (cmd + strlen (cmd), "=0x%x", regval); + + retval = ExeAppReq ("GDB", MWRITEREG, cmd, val); + if (retval) + error ("ExeAppReq returned %d: cmd = %s", retval, cmd); +} + +/* Prepare to store registers. Nothing to do here, since the ICE can write one + register at a time. */ + +static void +v850ice_prepare_to_store () +{ +} + +/* Read or write LEN bytes from inferior memory at MEMADDR, transferring + to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is + nonzero. Returns length of data written or read; 0 for error. */ + +/* ARGSUSED */ +static int +v850ice_xfer_memory (memaddr, myaddr, len, should_write, target) + CORE_ADDR memaddr; + char *myaddr; + int len; + int should_write; + struct target_ops *target; /* ignored */ +{ + long retval; + char cmd[100]; + + if (should_write) + { +#if 1 + sprintf (cmd, "memory b c 0x%x=0x00 l=%d", (int)memaddr, len); + retval = ExeAppReq ("GDB", MWRITEBLOCK, cmd, myaddr); +#else + sprintf (cmd, "memory b c 0x%x=0x%x", (int)memaddr, *myaddr & 0xff); + retval = ExeAppReq ("GDB", MWRITEBLOCK, cmd, myaddr); + return 1; +#endif + } + else + { + unsigned char *tmp; + int i; + + tmp = alloca (len + 100); + memset (tmp + len, 0xff, 100); + + sprintf (cmd, "memory b 0x%x l=%d", (int)memaddr, len); + retval = ExeAppReq ("GDB", MREADBLOCK, cmd, tmp); + + for (i = 0; i < 100; i++) + { + if (tmp[len + i] != 0xff) + { + warning ("MREADBLOCK trashed bytes after transfer area."); + break; + } + } + memcpy (myaddr, tmp, len); + } + + if (retval) + error ("ExeAppReq returned %d: cmd = %s", retval, cmd); + + return len; +} + +static void +v850ice_files_info (ignore) + struct target_ops *ignore; +{ + puts_filtered ("Debugging a target via the NEC V850 ICE.\n"); +} + +static int +v850ice_insert_breakpoint (addr, contents_cache) + CORE_ADDR addr; + char *contents_cache; +{ + long retval; + char cmd[100]; + char val[100]; + + sprintf (cmd, "%d, ", addr); + +#if 1 + retval = ExeAppReq ("GDB", MSETBREAK, cmd, val); +#else + retval = ExeAppReq ("GDB", MSETHARDBRK, cmd, val); +#endif + if (retval) + error ("ExeAppReq (MSETBREAK) returned %d: cmd = %s", retval, cmd); + + return 0; +} + +static int +v850ice_remove_breakpoint (addr, contents_cache) + CORE_ADDR addr; + char *contents_cache; +{ + long retval; + char cmd[100]; + char val[100]; + + sprintf (cmd, "%d, ", addr); + +#if 1 + retval = ExeAppReq ("GDB", MREMOVEBREAK, cmd, val); +#else + retval = ExeAppReq ("GDB", MREMOVEHARDBRK, cmd, val); +#endif + if (retval) + error ("ExeAppReq (MREMOVEBREAK) returned %d: cmd = %s", retval, cmd); + + return 0; +} + +static void +v850ice_kill () +{ + target_mourn_inferior (); +} + +static void +v850ice_mourn () +{ +} + +/* Define the target subroutine names */ + +struct target_ops v850ice_ops = { + "ice", /* to_shortname */ + "NEC V850 ICE interface", /* to_longname */ + "Debug a system controlled by a NEC 850 ICE.", /* to_doc */ + v850ice_open, /* to_open */ + v850ice_close, /* to_close */ + NULL, /* to_attach */ + v850ice_detach, /* to_detach */ + v850ice_resume, /* to_resume */ + v850ice_wait, /* to_wait */ + v850ice_fetch_registers, /* to_fetch_registers */ + v850ice_store_registers, /* to_store_registers */ + v850ice_prepare_to_store, /* to_prepare_to_store */ + v850ice_xfer_memory, /* to_xfer_memory */ + v850ice_files_info, /* to_files_info */ + v850ice_insert_breakpoint, /* to_insert_breakpoint */ + v850ice_remove_breakpoint, /* to_remove_breakpoint */ + NULL, /* to_terminal_init */ + NULL, /* to_terminal_inferior */ + NULL, /* to_terminal_ours_for_output */ + NULL, /* to_terminal_ours */ + NULL, /* to_terminal_info */ + v850ice_kill, /* to_kill */ + generic_load, /* to_load */ + NULL, /* to_lookup_symbol */ + NULL, /* to_create_inferior */ + v850ice_mourn, /* to_mourn_inferior */ + 0, /* to_can_run */ + 0, /* to_notice_signals */ + NULL, /* to_thread_alive */ + 0, /* to_stop */ + process_stratum, /* to_stratum */ + NULL, /* to_next */ + 1, /* to_has_all_memory */ + 1, /* to_has_memory */ + 1, /* to_has_stack */ + 1, /* to_has_registers */ + 1, /* to_has_execution */ + NULL, /* sections */ + NULL, /* sections_end */ + OPS_MAGIC /* to_magic */ +}; + +void +_initialize_v850ice () +{ + add_target (&v850ice_ops); +} diff --git a/gdb/values.c b/gdb/values.c index afd8b03..ff29d31 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -91,6 +91,7 @@ allocate_value (type) VALUE_REGNO (val) = -1; VALUE_LAZY (val) = 0; VALUE_OPTIMIZED_OUT (val) = 0; + VALUE_BFD_SECTION (val) = NULL; val->modifiable = 1; return val; } @@ -219,6 +220,7 @@ value_copy (arg) VALUE_REGNO (val) = VALUE_REGNO (arg); VALUE_LAZY (val) = VALUE_LAZY (arg); VALUE_OPTIMIZED_OUT (val) = VALUE_OPTIMIZED_OUT (arg); + VALUE_BFD_SECTION (val) = VALUE_BFD_SECTION (arg); val->modifiable = arg->modifiable; if (!VALUE_LAZY (val)) { @@ -675,15 +677,11 @@ unpack_double (type, valaddr, invp) else if (nosign) { /* Unsigned -- be sure we compensate for signed LONGEST. */ -#ifndef _MSC_VER - return (ULONGEST) unpack_long (type, valaddr); -#else -#if (_MSC_VER > 900) +#if !defined (_MSC_VER) || (_MSC_VER > 900) return (ULONGEST) unpack_long (type, valaddr); #else /* FIXME!!! msvc22 doesn't support unsigned __int64 -> double */ return (LONGEST) unpack_long (type, valaddr); -#endif #endif /* _MSC_VER */ } else @@ -1318,7 +1316,7 @@ value_being_returned (valtype, retbuf, struct_return) addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf); if (!addr) error ("Function return value unknown"); - return value_at (valtype, addr); + return value_at (valtype, addr, NULL); } #endif -- 2.7.4