summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2020-09-08 18:55:20 +0200
committerPhilip Chimento <philip.chimento@gmail.com>2020-10-12 21:04:13 -0700
commit17217a35238f1001ab2b545b9bddfe4689bf0f38 (patch)
treead99b0e450bf62cd9d06b1b4241d726a09ae7012
parentffb1b14c1ef616515bd3c29e9ae1ed344e44c50a (diff)
downloadgjs-17217a35238f1001ab2b545b9bddfe4689bf0f38.tar.gz
arg: Improve debugging of numeric marshal conversions
-rw-r--r--gi/arg-cache.cpp8
-rw-r--r--gi/arg.cpp9
2 files changed, 16 insertions, 1 deletions
diff --git a/gi/arg-cache.cpp b/gi/arg-cache.cpp
index a2ff1bb3..c053865e 100644
--- a/gi/arg-cache.cpp
+++ b/gi/arg-cache.cpp
@@ -39,6 +39,7 @@
#include "gi/value.h"
#include "gjs/byteArray.h"
#include "gjs/jsapi-util.h"
+#include "util/log.h"
enum ExpectedType {
OBJECT,
@@ -377,6 +378,13 @@ GJS_JSAPI_RETURN_CONVENTION inline static bool gjs_arg_set_from_js_value(
return false;
}
+ gjs_debug_marshal(GJS_DEBUG_GFUNCTION, "%s set to value %s (type %s)",
+ GjsAutoChar(gjs_argument_display_name(
+ self->arg_name, GJS_ARGUMENT_ARGUMENT))
+ .get(),
+ std::to_string(gjs_arg_get<T>(arg)).c_str(),
+ Gjs::static_type_name<T>());
+
return true;
}
diff --git a/gi/arg.cpp b/gi/arg.cpp
index a8ebffa6..df8205fc 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -1571,13 +1571,20 @@ GJS_JSAPI_RETURN_CONVENTION inline static bool gjs_arg_set_from_js_value(
if (out_of_range) {
GjsAutoChar display_name =
gjs_argument_display_name(arg_name, arg_type);
- gjs_throw(cx, "value is out of range for %s (type %s)",
+ gjs_throw(cx, "value %s is out of range for %s (type %s)",
+ std::to_string(gjs_arg_get<T>(arg)).c_str(),
display_name.get(), Gjs::static_type_name<T>());
}
return false;
}
+ gjs_debug_marshal(
+ GJS_DEBUG_GFUNCTION, "%s set to value %s (type %s)",
+ GjsAutoChar(gjs_argument_display_name(arg_name, arg_type)).get(),
+ std::to_string(gjs_arg_get<T>(arg)).c_str(),
+ Gjs::static_type_name<T>());
+
return true;
}