Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [commit] Simplify gdbarch.sh a tiny bit
Date: Thu, 10 Jul 2003 22:00:00 -0000	[thread overview]
Message-ID: <3F0DE1F3.2010401@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

Hello,

The attached simplfies gdbarch.sh a tiny bit - it uses gdb_assert 
instead of internal_error in a few places (from memory gdbarch.sh was 
written before gdb_assert was added).

committed,
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2272 bytes --]

2003-07-10  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh: Use gdb_assert instead of internal_error.  Compare
	functions against NULL, not 0.
	* gdbarch.c: Re-generate.
	
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.255
diff -u -r1.255 gdbarch.sh
--- gdbarch.sh	3 Jul 2003 22:14:42 -0000	1.255
+++ gdbarch.sh	10 Jul 2003 21:57:50 -0000
@@ -1733,7 +1733,7 @@
 	then
 	    printf "  return ${predicate};\n"
 	else
-	    printf "  return gdbarch->${function} != 0;\n"
+	    printf "  return gdbarch->${function} != NULL;\n"
 	fi
 	printf "}\n"
     fi
@@ -1749,13 +1749,11 @@
 	fi
 	printf "{\n"
         printf "  gdb_assert (gdbarch != NULL);\n"
-        printf "  if (gdbarch->${function} == 0)\n"
-        printf "    internal_error (__FILE__, __LINE__,\n"
-	printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+	printf "  gdb_assert (gdbarch->${function} != NULL);\n"
 	if class_is_predicate_p && test -n "${predicate}"
 	then
 	    # Allow a call to a function with a predicate.
-	    printf "  /* Ignore predicate (${predicate}).  */\n"
+	    printf "  /* Do not check predicate: ${predicate}, allow call.  */\n"
 	fi
 	printf "  if (gdbarch_debug >= 2)\n"
 	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
@@ -1801,14 +1799,12 @@
 	    printf "  /* Skip verify of ${function}, invalid_p == 0 */\n"
 	elif [ -n "${invalid_p}" ]
 	then
-	  printf "  if (${invalid_p})\n"
-	  printf "    internal_error (__FILE__, __LINE__,\n"
-	  printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+	    printf "  /* Check variable is valid.  */\n"
+	    printf "  gdb_assert (!(${invalid_p}));\n"
 	elif [ -n "${predefault}" ]
 	then
-	  printf "  if (gdbarch->${function} == ${predefault})\n"
-	  printf "    internal_error (__FILE__, __LINE__,\n"
-	  printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+	    printf "  /* Check variable changed from pre-default.  */\n"
+	    printf "  gdb_assert (gdbarch->${function} != ${predefault});\n"
 	fi
 	printf "  if (gdbarch_debug >= 2)\n"
 	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"

             reply	other threads:[~2003-07-10 22:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10 22:00 Andrew Cagney [this message]
2003-07-10 23:07 ` Theodore A. Roth
2003-07-10 23:22   ` Andrew Cagney
2003-07-11  1:36     ` Andrew Cagney
2003-07-11 15:23       ` Theodore A. Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F0DE1F3.2010401@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox