[gjs] arg: Improve debugging of numeric marshal conversions
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] arg: Improve debugging of numeric marshal conversions
- Date: Tue, 13 Oct 2020 04:07:57 +0000 (UTC)
commit 17217a35238f1001ab2b545b9bddfe4689bf0f38
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Sep 8 18:55:20 2020 +0200
arg: Improve debugging of numeric marshal conversions
gi/arg-cache.cpp | 8 ++++++++
gi/arg.cpp | 9 ++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
---
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]