aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-08-16 22:49:23 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-08-16 22:49:23 +0000
commit29ca15bb297d2a4c98224f8518206547432c2b69 (patch)
treee850eb5dd1c972df43c32c547f86e9e0e33d9fff
parent1ccd703591b3023c434f55efb6eb4ac7b5019ecd (diff)
downloadgcc-29ca15bb297d2a4c98224f8518206547432c2b69.zip
gcc-29ca15bb297d2a4c98224f8518206547432c2b69.tar.gz
gcc-29ca15bb297d2a4c98224f8518206547432c2b69.tar.bz2
compiler: print runtime.hex in hex
The gc compiler recognizes the type runtime.hex and prints values in this type as hex. Do the same here. This makes debugging runtime crashes slightly better. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190597 From-SVN: r274591
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc8
-rw-r--r--gcc/go/gofrontend/runtime.def3
3 files changed, 11 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index ba7282e..48b4249 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-480477ca64c3001b9c7e92ef8b978dc92a5912d2
+0f6d673d5b1a3474c3424cb6994ae8ff9baed255
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index abc4bba..995a18c 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -10294,7 +10294,13 @@ Builtin_call_expression::do_get_backend(Translate_context* context)
{
Type* itype = Type::lookup_integer_type("uint64");
arg = Expression::make_cast(itype, arg, location);
- code = Runtime::PRINTUINT;
+ if (gogo->compiling_runtime()
+ && type->named_type() != NULL
+ && gogo->unpack_hidden_name(type->named_type()->name())
+ == "hex")
+ code = Runtime::PRINTHEX;
+ else
+ code = Runtime::PRINTUINT;
}
else if (type->integer_type() != NULL)
{
diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def
index c754739..dfd6ebd 100644
--- a/gcc/go/gofrontend/runtime.def
+++ b/gcc/go/gofrontend/runtime.def
@@ -384,6 +384,9 @@ DEF_GO_RUNTIME(PRINTSTRING, "runtime.printstring", P1(STRING), R0())
// Print a uint64 (for print/println).
DEF_GO_RUNTIME(PRINTUINT, "runtime.printuint", P1(UINT64), R0())
+// Print a uint64 in hex (for print/println, used for runtime.hex type).
+DEF_GO_RUNTIME(PRINTHEX, "runtime.printhex", P1(UINT64), R0())
+
// Print a int64 (for print/println).
DEF_GO_RUNTIME(PRINTINT, "runtime.printint", P1(INT64), R0())