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]

[commit] Print function, not macro name in gdbarch_dump


More cleanup. Print the value of the underlying architecture method's name. For macro's, also print the macro definition.

committed,
Andrew
2004-06-21  Andrew Cagney  <cagney@gnu.org>

	* gdbarch.sh: For gdbarch_dump, print the "function" rather than
	macro name, and the function rather than macro value.  Only wrap
	macro print statements in #ifdef.  Move format logic to where it
	is needed.
	* gdbarch.c: Re-generate.
	
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.332
diff -p -u -r1.332 gdbarch.sh
--- gdbarch.sh	21 Jun 2004 15:01:04 -0000	1.332
+++ gdbarch.sh	21 Jun 2004 17:53:12 -0000
@@ -109,23 +109,6 @@ EOF
 		* ) test "${staticdefault}" || staticdefault=0 ;;
 	    esac
 
-	    # 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 "${class}" in
 	    F | V | M )
 		case "${invalid_p}" in
@@ -1550,56 +1533,62 @@ do
     # First the predicate
     if class_is_predicate_p
     then
-	if class_is_multiarch_p
+	if test -n "${macro}"
 	then
-	    printf "  fprintf_unfiltered (file,\n"
-	    printf "                      \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n"
-	    printf "                      gdbarch_${function}_p (current_gdbarch));\n"
-	else
 	    printf "#ifdef ${macro}_P\n"
 	    printf "  fprintf_unfiltered (file,\n"
 	    printf "                      \"gdbarch_dump: %%s # %%s\\\\n\",\n"
 	    printf "                      \"${macro}_P()\",\n"
 	    printf "                      XSTRING (${macro}_P ()));\n"
-	    printf "  fprintf_unfiltered (file,\n"
-	    printf "                      \"gdbarch_dump: ${macro}_P() = %%d\\\\n\",\n"
-	    printf "                      ${macro}_P ());\n"
 	    printf "#endif\n"
 	fi
-    fi
-    # multiarch functions don't have macros.
-    if class_is_multiarch_p
-    then
 	printf "  fprintf_unfiltered (file,\n"
-	printf "                      \"gdbarch_dump: ${function} = 0x%%08lx\\\\n\",\n"
-	printf "                      (long) current_gdbarch->${function});\n"
-	continue
+	printf "                      \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n"
+	printf "                      gdbarch_${function}_p (current_gdbarch));\n"
     fi
     # Print the macro definition.
-    printf "#ifdef ${macro}\n"
-    if class_is_function_p
+    if test -n "${macro}"
     then
-	printf "  fprintf_unfiltered (file,\n"
-	printf "                      \"gdbarch_dump: %%s # %%s\\\\n\",\n"
-	printf "                      \"${macro}(${actual})\",\n"
-	printf "                      XSTRING (${macro} (${actual})));\n"
-    else
-	printf "  fprintf_unfiltered (file,\n"
-	printf "                      \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
-	printf "                      XSTRING (${macro}));\n"
+	printf "#ifdef ${macro}\n"
+	if class_is_function_p
+	then
+	    printf "  fprintf_unfiltered (file,\n"
+	    printf "                      \"gdbarch_dump: %%s # %%s\\\\n\",\n"
+	    printf "                      \"${macro}(${actual})\",\n"
+	    printf "                      XSTRING (${macro} (${actual})));\n"
+	else
+	    printf "  fprintf_unfiltered (file,\n"
+	    printf "                      \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
+	    printf "                      XSTRING (${macro}));\n"
+	fi
+	printf "#endif\n"
     fi
+    # Print the corresponding value.
     if class_is_function_p
     then
 	printf "  fprintf_unfiltered (file,\n"
-	printf "                      \"gdbarch_dump: ${macro} = <0x%%08lx>\\\\n\",\n"
-	printf "                      (long) current_gdbarch->${function}\n"
-	printf "                      /*${macro} ()*/);\n"
+	printf "                      \"gdbarch_dump: ${function} = <0x%%lx>\\\\n\",\n"
+	printf "                      (long) current_gdbarch->${function});\n"
     else
+	# It is a variable
+	case "${fmt}:${print}:${returntype}" in
+	    ::CORE_ADDR )
+		fmt="0x%s"
+		print="paddr_nz (current_gdbarch->${function})"
+		;;
+	    ::* )
+	        fmt="%s"
+		print="paddr_d (current_gdbarch->${function})"
+		;;
+	    * )
+	        test "${fmt}" || fmt="%ld"
+		test "${print}" || print="(long) (current_gdbarch->${function})"
+		;;
+        esac
 	printf "  fprintf_unfiltered (file,\n"
-	printf "                      \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
+	printf "                      \"gdbarch_dump: ${function} = %s\\\\n\",\n" "${fmt}"
 	printf "                      ${print});\n"
     fi
-    printf "#endif\n"
 done
 cat <<EOF
   if (current_gdbarch->dump_tdep != NULL)

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