This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] print ``int'' with %d not %ld (long) in gdbarch


To follow up the problem that JimB encountered, this patch tweeks 
gdbarch.sh so that ``int'' variables are printed using %d.

Andrew
2001-12-25  Andrew Cagney  <ac131313@redhat.com>

	* gdbarch.sh: When an int variable, print value using %d instead
	of %ld.
	* gdbarch.c: Re-generate.
	
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.100
diff -u -r1.100 gdbarch.sh
--- gdbarch.sh	2001/12/20 17:23:06	1.100
+++ gdbarch.sh	2001/12/25 22:00:42
@@ -84,8 +84,24 @@
 	    # NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
 	    # multi-arch defaults.
 	    # test "${predefault}" || predefault=0
+
+	    # come up with a format, use a few guesses for variables
+	    case ":${class}:${fmt}:${print}:" in
+		:[vV]::: )
+		    if [ "${returntype}" = int ]
+		    then
+			fmt="%d"
+			print="${macro}"
+		    elif [ "${returntype}" = long ]
+		    then
+			fmt="%ld"
+			print="${macro}"
+		    fi
+		    ;;
+	    esac
 	    test "${fmt}" || fmt="%ld"
 	    test "${print}" || print="(long) ${macro}"
+
 	    case "${invalid_p}" in
 		0 ) valid_p=1 ;;
 		"" )
@@ -1496,6 +1512,7 @@
 	printf "                        (long) current_gdbarch->${function});\n"
 	continue
     fi
+    # Print the macro definition.
     printf "#ifdef ${macro}\n"
     if [ "x${returntype}" = "xvoid" ]
     then
@@ -1513,6 +1530,7 @@
 	printf "                      \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
 	printf "                      XSTRING (${macro}));\n"
     fi
+    # Print the architecture vector value
     if [ "x${returntype}" = "xvoid" ]
     then
 	printf "#endif\n"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]