Commit dd391d26 authored by Torsten Schönfeld's avatar Torsten Schönfeld

Harmonize and improve debug output

parent f2b0048a
......@@ -27,7 +27,10 @@
/* #define NOISY */
#ifdef NOISY
# define dwarn(...) warn(__VA_ARGS__)
# define dwarn(msg...) G_STMT_START { \
g_printerr ("%s: ", G_STRFUNC); \
g_printerr (msg); \
} G_STMT_END
#else
# define dwarn(...)
#endif
......@@ -397,17 +400,20 @@ _register_types (class, namespace, package)
info_type = g_base_info_get_type (info);
name = g_base_info_get_name (info);
dwarn ("setting up %s::%s\n", namespace, name);
dwarn ("setting up %s.%s\n", namespace, name);
if (info_type == GI_INFO_TYPE_CONSTANT) {
dwarn (" -> constant\n");
av_push (constants, newSVpv (name, 0));
}
if (info_type == GI_INFO_TYPE_FUNCTION) {
dwarn (" -> global function\n");
av_push (global_functions, newSVpv (name, 0));
}
if (info_type == GI_INFO_TYPE_INTERFACE) {
dwarn (" -> interface\n");
av_push (interfaces, newSVpv (name, 0));
}
......@@ -419,6 +425,7 @@ _register_types (class, namespace, package)
info_type == GI_INFO_TYPE_ENUM ||
info_type == GI_INFO_TYPE_FLAGS)
{
dwarn (" looking for methods\n");
store_methods (namespaced_functions, info, info_type);
}
......@@ -426,10 +433,12 @@ _register_types (class, namespace, package)
info_type == GI_INFO_TYPE_STRUCT ||
info_type == GI_INFO_TYPE_UNION)
{
dwarn (" looking for fields\n");
store_fields (fields, info, info_type);
}
if (info_type == GI_INFO_TYPE_OBJECT) {
dwarn (" looking for vfuncs\n");
store_objects_with_vfuncs (objects_with_vfuncs, info);
}
......@@ -559,7 +568,7 @@ _register_boxed_synonym (class, const gchar *reg_basename, const gchar *reg_name
ccroak ("Could not lookup GType from function %s",
syn_gtype_function);
dwarn ("registering synonym %s => %s",
dwarn ("%s => %s",
g_type_name (reg_type),
g_type_name (syn_type));
gperl_register_boxed_synonym (reg_type, syn_type);
......@@ -759,7 +768,7 @@ _install_overrides (class, basename, object_name, target_package)
GType gtype;
gpointer klass;
CODE:
dwarn ("_install_overrides: %s%s for %s\n",
dwarn ("%s.%s for %s\n",
basename, object_name, target_package);
repository = g_irepository_get_default ();
info = g_irepository_find_by_name (repository, basename, object_name);
......@@ -856,7 +865,7 @@ _invoke_fallback_vfunc (class, vfunc_package, vfunc_name, target_package, ...)
gint field_offset;
gpointer func_pointer;
PPCODE:
dwarn ("_invoke_fallback_vfunc: %s::%s, target = %s\n",
dwarn ("%s::%s, target = %s\n",
vfunc_package, vfunc_name, target_package);
gtype = gperl_object_type_from_package (target_package);
klass = g_type_class_peek (gtype);
......@@ -926,8 +935,7 @@ _use_generic_signal_marshaller_for (class, const gchar *package, const gchar *si
signal_info);
g_base_info_unref (closure_marshal_info);
dwarn ("_use_generic_signal_marshaller_for: "
"package %s, signal %s => closure %p\n",
dwarn ("package = %s, signal = %s => closure = %p\n",
package, signal, closure);
gperl_signal_set_marshaller_for (gtype, (gchar*) signal, (GClosureMarshal) closure);
......@@ -953,7 +961,7 @@ _use_generic_signal_marshaller_for (class, const gchar *package, const gchar *si
* work correctly for signals prior to commit
* d8970fbc500a8b20853b564536251315587450d9 in
* gobject-introspection. */
warn ("*** Cannot use generic signal marshallers for signal %s of %s "
warn ("*** Cannot use generic signal marshallers for signal '%s' of %s "
"unless gobject-introspection >= 1.33.10; "
"any handlers connected to the signal "
"might thus be invoked incorrectly\n",
......
......@@ -65,7 +65,7 @@ static void
release_perl_callback (gpointer data)
{
GPerlI11nPerlCallbackInfo *info = data;
dwarn ("releasing Perl callback info %p\n", info);
dwarn ("info = %p\n", info);
/* g_callable_info_free_closure reaches into info->cif, so it needs to
* be called before we free it. See
......@@ -119,7 +119,7 @@ static void
release_c_callback (gpointer data)
{
GPerlI11nCCallbackInfo *info = data;
dwarn ("releasing C callback info %p\n", info);
dwarn ("info = %p\n", info);
/* FIXME: we cannot call the destroy notify here because it might be
* our own release_perl_callback which would try to free the ffi stuff
......
......@@ -25,7 +25,7 @@ get_function_info (GIRepository *repository,
const gchar *namespace,
const gchar *method)
{
dwarn ("%s: %s, %s, %s\n", G_STRFUNC, basename, namespace, method);
dwarn ("%s, %s, %s\n", basename, namespace, method);
if (namespace) {
GIFunctionInfo *function_info = NULL;
......
......@@ -86,7 +86,7 @@ invoke_c_code (GICallableInfo *info,
* point. */
iinfo.base.current_pos = i; /* + method_offset; */
dwarn (" arg %d, tag: %d (%s), is_pointer: %d, is_automatic: %d\n",
dwarn ("arg %d: tag = %d (%s), is_pointer = %d, is_automatic = %d\n",
i,
g_type_info_get_tag (arg_type),
g_type_tag_to_string (g_type_info_get_tag (arg_type)),
......@@ -232,6 +232,7 @@ invoke_c_code (GICallableInfo *info,
)
{
SV *value;
dwarn ("return value: type = %p\n", iinfo.base.return_type_info);
value = SAVED_STACK_SV (arg_to_sv (&return_value,
iinfo.base.return_type_info,
iinfo.base.return_type_transfer,
......@@ -259,6 +260,7 @@ invoke_c_code (GICallableInfo *info,
{
GITransfer transfer;
SV *sv;
dwarn ("out/inout arg at pos %d\n", i);
/* If we allocated the memory ourselves, we always own it. */
transfer = g_arg_info_is_caller_allocates (arg_info)
? GI_TRANSFER_CONTAINER
......@@ -281,7 +283,7 @@ invoke_c_code (GICallableInfo *info,
_clear_c_invocation_info (&iinfo);
dwarn (" number of return values: %d\n", n_return_values);
dwarn ("n_return_values = %d\n", n_return_values);
PUTBACK;
}
......@@ -301,11 +303,9 @@ _prepare_c_invocation_info (GPerlI11nCInvocationInfo *iinfo,
prepare_invocation_info ((GPerlI11nInvocationInfo *) iinfo, info);
dwarn ("C invoke: %s::%s::%s => %s\n"
" n_args: %d\n",
dwarn ("%s::%s::%s => %s\n",
package, namespace, function,
g_base_info_get_name (info),
g_callable_info_get_n_args (info));
g_base_info_get_name (info));
iinfo->target_package = package;
iinfo->target_namespace = namespace;
......@@ -347,12 +347,16 @@ _prepare_c_invocation_info (GPerlI11nCInvocationInfo *iinfo,
iinfo->n_invoke_args++;
}
dwarn ("C invoke: %s\n"
" n_args: %d, n_invoke_args: %d, n_given_args: %d\n"
" is_constructor: %d, is_method: %d\n",
iinfo->base.is_vfunc ? g_base_info_get_name (info) : g_function_info_get_symbol (info),
iinfo->base.n_args, iinfo->n_invoke_args, iinfo->n_given_args,
iinfo->is_constructor, iinfo->is_method);
dwarn (" args = %u, given = %u, invoke = %u\n",
iinfo->base.n_args,
iinfo->n_given_args,
iinfo->n_invoke_args);
dwarn (" symbol = %s\n",
iinfo->base.is_vfunc ? g_base_info_get_name (info) : g_function_info_get_symbol (info));
dwarn (" is_constructor = %d, is_method = %d, throws = %d\n",
iinfo->is_constructor, iinfo->is_method, iinfo->throws);
/* allocate enough space for all args in both the out and in lists.
* we'll only use as much as we need. since function argument lists
......
......@@ -64,9 +64,9 @@ invoke_perl_code (ffi_cif* cif, gpointer resp, gpointer* args, gpointer userdata
data_sv = info->data ? SvREFCNT_inc (info->data) : NULL;
first_sv = info->swap_data ? data_sv : instance_sv;
last_sv = info->swap_data ? instance_sv : data_sv;
dwarn (" info->data = %p, info->swap_data = %d\n",
dwarn ("info->data = %p, info->swap_data = %d\n",
info->data, info->swap_data);
dwarn (" instance = %p, data = %p, first = %p, last = %p\n",
dwarn ("instance = %p, data = %p, first = %p, last = %p\n",
instance_sv, data_sv, first_sv, last_sv);
if (first_sv)
XPUSHs (sv_2mortal (first_sv));
......@@ -85,25 +85,19 @@ invoke_perl_code (ffi_cif* cif, gpointer resp, gpointer* args, gpointer userdata
iinfo.base.current_pos = i;
dwarn ("arg info: %s (%p)\n"
" direction: %d\n"
" is return value: %d\n"
" is optional: %d\n"
" may be null: %d\n"
" transfer: %d\n",
g_base_info_get_name (arg_info), arg_info,
g_arg_info_get_direction (arg_info),
dwarn ("arg %d: info = %p (%s)\n",
i, arg_info, g_base_info_get_name (arg_info));
dwarn (" dir = %d, is retval = %d, is optional = %d, may be null = %d, transfer = %d\n",
direction,
g_arg_info_is_return_value (arg_info),
g_arg_info_is_optional (arg_info),
g_arg_info_may_be_null (arg_info),
g_arg_info_get_ownership_transfer (arg_info));
dwarn ("arg type: %p\n"
" is pointer: %d\n"
" tag: %s (%d)\n",
transfer);
dwarn (" arg type = %p, is pointer = %d, tag = %d (%s)\n",
arg_type,
g_type_info_is_pointer (arg_type),
g_type_tag_to_string (g_type_info_get_tag (arg_type)), g_type_info_get_tag (arg_type));
g_type_info_get_tag (arg_type),
g_type_tag_to_string (g_type_info_get_tag (arg_type)));
if (direction == GI_DIRECTION_IN ||
direction == GI_DIRECTION_INOUT)
......@@ -221,6 +215,8 @@ invoke_perl_code (ffi_cif* cif, gpointer resp, gpointer* args, gpointer userdata
* (nor is there an annotation for it). */
gboolean may_be_null = TRUE;
gboolean is_caller_allocated = g_arg_info_is_caller_allocates (arg_info);
dwarn ("out/inout arg, pos = %d, is_caller_allocated = %d\n",
i, is_caller_allocated);
if (is_caller_allocated) {
tmp_arg.v_pointer = out_pointer;
}
......@@ -248,13 +244,11 @@ invoke_perl_code (ffi_cif* cif, gpointer resp, gpointer* args, gpointer userdata
transfer = iinfo.base.return_type_transfer;
may_be_null = g_callable_info_may_return_null (cb_interface); /* FIXME */
dwarn ("ret type: %p\n"
" is pointer: %d\n"
" tag: %d\n"
" transfer: %d\n",
type_info,
dwarn ("return value: type = %p\n", type_info);
dwarn (" is pointer = %d, tag = %d (%s), transfer = %d\n",
g_type_info_is_pointer (type_info),
g_type_info_get_tag (type_info),
g_type_tag_to_string (g_type_info_get_tag (type_info)),
transfer);
sv_to_arg (POPs, &arg, NULL, type_info,
......@@ -305,7 +299,8 @@ invoke_perl_signal_handler (ffi_cif* cif, gpointer resp, gpointer* args, gpointe
PERL_UNUSED_VAR (resp);
PERL_UNUSED_VAR (marshal_data);
dwarn ("invoke_perl_signal_handler: n args %d\n",
dwarn ("%s, n_args = %d\n",
g_base_info_get_name (signal_info->interface),
g_callable_info_get_n_args (signal_info->interface));
cb_info = create_perl_callback_closure (signal_info->interface,
......@@ -342,8 +337,7 @@ _prepare_perl_invocation_info (GPerlI11nPerlInvocationInfo *iinfo,
prepare_invocation_info ((GPerlI11nInvocationInfo *) iinfo, info);
dwarn ("Perl invoke: %s\n"
" n_args: %d\n",
dwarn ("%s, n_args = %d\n",
g_base_info_get_name (info),
g_callable_info_get_n_args (info));
......
......@@ -7,10 +7,7 @@ prepare_invocation_info (GPerlI11nInvocationInfo *iinfo,
gint orig_n_args;
guint i;
dwarn ("invoke: %s\n"
" n_args: %d\n",
g_base_info_get_name (info),
g_callable_info_get_n_args (info));
dwarn ("%s\n", g_base_info_get_name (info));
iinfo->interface = info;
......@@ -24,6 +21,7 @@ prepare_invocation_info (GPerlI11nInvocationInfo *iinfo,
orig_n_args = g_callable_info_get_n_args (info);
g_assert (orig_n_args >= 0);
iinfo->n_args = (guint) orig_n_args;
dwarn (" n_args = %u\n", iinfo->n_args);
if (iinfo->n_args) {
iinfo->arg_infos = gperl_alloc_temp (sizeof (GITypeInfo*) * iinfo->n_args);
......
......@@ -13,7 +13,10 @@ sv_to_arg (SV * sv,
{
GITypeTag tag = g_type_info_get_tag (type_info);
if (!gperl_sv_is_defined (sv))
dwarn ("type info = %p, arg info = %p, tag = %d (%s)\n",
type_info, arg_info, tag, g_type_tag_to_string (tag));
if (!gperl_sv_is_defined (sv)) {
/* Interfaces, booleans and void types need to be able to
* handle undef separately.*/
if (!may_be_null && tag != GI_TYPE_TAG_INTERFACE
......@@ -27,13 +30,13 @@ sv_to_arg (SV * sv,
ccroak ("undefined value encountered");
}
}
}
switch (tag) {
case GI_TYPE_TAG_VOID:
/* returns NULL if no match is found */
arg->v_pointer = sv_to_callback_data (sv, invocation_info);
dwarn (" argument with no type information -> pointer %p\n",
arg->v_pointer);
dwarn (" -> pointer %p\n", arg->v_pointer);
break;
case GI_TYPE_TAG_BOOLEAN:
......@@ -96,7 +99,6 @@ sv_to_arg (SV * sv,
break;
case GI_TYPE_TAG_INTERFACE:
dwarn (" type %p -> interface\n", type_info);
sv_to_interface (arg_info, type_info, transfer, may_be_null,
sv, arg, invocation_info);
break;
......@@ -153,7 +155,7 @@ arg_to_sv (GIArgument * arg,
GITypeTag tag = g_type_info_get_tag (info);
gboolean own = transfer >= GI_TRANSFER_CONTAINER;
dwarn (" arg_to_sv: info %p with type tag %d (%s)\n",
dwarn ("info = %p, tag = %d (%s)\n",
info, tag, g_type_tag_to_string (tag));
switch (tag) {
......@@ -164,7 +166,7 @@ arg_to_sv (GIArgument * arg,
if (sv) {
SvREFCNT_inc (sv);
}
dwarn (" argument with no type information -> SV %p\n", sv);
dwarn (" -> SV %p\n", sv);
return sv ? sv : &PL_sv_undef;
}
......
......@@ -37,28 +37,28 @@ _need_struct_value_semantics (GIArrayType array_type, GITypeInfo *param_info, GI
static void
_free_raw_array (gpointer raw_array)
{
dwarn ("free_raw_array %p\n", raw_array);
dwarn ("%p\n", raw_array);
g_free (raw_array);
}
static void
_free_array (GArray *array)
{
dwarn ("free_array %p\n", array);
dwarn ("%p\n", array);
g_array_free (array, TRUE);
}
static void
_free_ptr_array (GPtrArray *array)
{
dwarn ("free_ptr_array %p\n", array);
dwarn ("%p\n", array);
g_ptr_array_free (array, TRUE);
}
static void
_free_byte_array (GByteArray *array)
{
dwarn ("free_byte_array %p\n", array);
dwarn ("%p\n", array);
g_byte_array_free (array, TRUE);
}
......@@ -80,6 +80,8 @@ array_to_sv (GITypeInfo *info,
gssize length = -1, i;
AV *av;
dwarn ("pointer %p\n", pointer);
if (pointer == NULL) {
return &PL_sv_undef;
}
......@@ -146,11 +148,11 @@ array_to_sv (GITypeInfo *info,
need_struct_value_semantics =
_need_struct_value_semantics (array_type, param_info, param_tag);
dwarn (" C array: pointer %p, array %p, elements %p, "
"length %"G_GSSIZE_FORMAT", item size %"G_GSIZE_FORMAT", "
"param_info %p with type tag %d (%s)\n",
pointer, array, elements,
length, item_size,
dwarn ("type %d, array %p, elements %p\n",
array_type, array, elements);
dwarn ("length %"G_GSSIZE_FORMAT", item size %"G_GSIZE_FORMAT", param_info %p, param_tag %d (%s)\n",
length,
item_size,
param_info,
param_tag,
g_type_tag_to_string (param_tag));
......@@ -159,6 +161,7 @@ array_to_sv (GITypeInfo *info,
GIArgument arg;
SV *value;
gpointer element = elements + ((gsize) i) * item_size;
dwarn (" element %"G_GSSIZE_FORMAT": %p\n", i, element);
if (need_struct_value_semantics) {
raw_to_arg (&element, &arg, param_info);
} else {
......@@ -188,6 +191,9 @@ array_to_sv (GITypeInfo *info,
g_base_info_unref ((GIBaseInfo *) param_info);
dwarn (" -> AV %p of length %"G_GSIZE_FORMAT"\n",
av, av_len (av) + 1);
return newRV_noinc ((SV *) av);
}
......@@ -212,7 +218,7 @@ sv_to_array (GITransfer transfer,
gsize item_size;
gboolean need_struct_value_semantics;
dwarn ("%s: sv %p\n", G_STRFUNC, sv);
dwarn ("sv %p\n", sv);
/* Add an array info entry even before the undef check so that the
* corresponding length arg is set to zero later by
......@@ -241,9 +247,11 @@ sv_to_array (GITransfer transfer,
param_info = g_type_info_get_param_type (type_info, 0);
param_tag = g_type_info_get_tag (param_info);
dwarn (" GArray: param_info %p with type tag %d (%s) and transfer %d\n",
param_info, param_tag,
g_type_tag_to_string (g_type_info_get_tag (param_info)),
dwarn ("type %d, param_info %p, param_tag %d (%s), transfer %d\n",
array_type,
param_info,
param_tag,
g_type_tag_to_string (param_tag),
transfer);
need_struct_value_semantics =
......@@ -270,10 +278,10 @@ sv_to_array (GITransfer transfer,
for (i = 0; i < length; i++) {
SV **svp;
svp = av_fetch (av, i, 0);
dwarn (" element %"G_GSIZE_FORMAT": svp = %p\n", i, svp);
if (svp && gperl_sv_is_defined (*svp)) {
GIArgument arg;
dwarn (" converting SV %p\n", *svp);
/* FIXME: Is it OK to always allow undef here? */
sv_to_arg (*svp, &arg, NULL, param_info,
item_transfer, TRUE, NULL);
......@@ -301,8 +309,6 @@ sv_to_array (GITransfer transfer,
}
}
dwarn (" -> array %p of size %d\n", array, array->len);
if (length_pos >= 0) {
array_info->length = length;
}
......@@ -331,5 +337,8 @@ sv_to_array (GITransfer transfer,
g_base_info_unref ((GIBaseInfo *) param_info);
dwarn (" -> array %p of length %"G_GSIZE_FORMAT"\n",
return_array, length);
return return_array;
}
......@@ -12,7 +12,7 @@ sv_to_callback (GIArgInfo * arg_info,
/* the destroy notify func is handled by _handle_automatic_arg */
dwarn (" Perl callback at %d (%s)\n",
dwarn ("pos = %d, name = %s\n",
invocation_info->current_pos,
g_base_info_get_name (arg_info));
......@@ -23,7 +23,7 @@ sv_to_callback (GIArgInfo * arg_info,
callback_info->free_after_use = FALSE;
g_base_info_unref (callback_interface_info);
dwarn (" Perl callback data at %d, destroy at %d\n",
dwarn (" data at %d, destroy at %d\n",
callback_info->data_pos, callback_info->destroy_pos);
scope = (!gperl_sv_is_defined (sv))
......@@ -31,17 +31,17 @@ sv_to_callback (GIArgInfo * arg_info,
: g_arg_info_get_scope (arg_info);
switch (scope) {
case GI_SCOPE_TYPE_CALL:
dwarn (" Perl callback has scope 'call'\n");
dwarn (" scope = 'call'\n");
free_after_call (invocation_info,
(GFunc) release_perl_callback, callback_info);
break;
case GI_SCOPE_TYPE_NOTIFIED:
dwarn (" Perl callback has scope 'notified'\n");
dwarn (" scope = 'notified'\n");
/* This case is already taken care of by the notify
* stuff above */
break;
case GI_SCOPE_TYPE_ASYNC:
dwarn (" Perl callback has scope 'async'\n");
dwarn (" scope = 'async'\n");
/* FIXME: callback_info->free_after_use = TRUE; */
break;
default:
......@@ -53,7 +53,7 @@ sv_to_callback (GIArgInfo * arg_info,
g_slist_prepend (invocation_info->callback_infos,
callback_info);
dwarn (" returning Perl closure %p from info %p\n",
dwarn (" -> closure %p from info %p\n",
callback_info->closure, callback_info);
return callback_info->closure;
}
......@@ -68,7 +68,7 @@ sv_to_callback_data (SV * sv,
for (l = invocation_info->callback_infos; l != NULL; l = l->next) {
GPerlI11nPerlCallbackInfo *callback_info = l->data;
if (callback_info->data_pos == ((gint) invocation_info->current_pos)) {
dwarn (" user data for Perl callback %p\n",
dwarn ("user data for Perl callback %p\n",
callback_info);
attach_perl_callback_data (callback_info, sv);
/* If the user did not specify any code and data and if
......@@ -81,7 +81,7 @@ sv_to_callback_data (SV * sv,
!gperl_sv_is_defined (callback_info->data) &&
-1 == callback_info->destroy_pos)
{
dwarn (" handing over NULL");
dwarn (" -> handing over NULL");
return NULL;
}
return callback_info;
......@@ -89,7 +89,7 @@ sv_to_callback_data (SV * sv,
}
if (invocation_info->is_callback) {
GPerlI11nCCallbackInfo *wrapper = INT2PTR (GPerlI11nCCallbackInfo*, SvIV (sv));
dwarn (" user data for C callback %p\n", wrapper);
dwarn ("user data for C callback %p\n", wrapper);
return wrapper->data;
}
return NULL;
......@@ -107,7 +107,7 @@ callback_to_sv (GICallableInfo *interface, gpointer func, GPerlI11nInvocationInf
for (l = invocation_info->callback_infos; l != NULL; l = l->next) {
GPerlI11nCCallbackInfo *callback_info = l->data;
if ((gint) invocation_info->current_pos == callback_info->destroy_pos) {
dwarn (" destroy notify for C callback %p\n",
dwarn ("destroy notify for C callback %p\n",
callback_info);
callback_info->destroy = func;
/* release_c_callback is called from
......@@ -119,7 +119,7 @@ callback_to_sv (GICallableInfo *interface, gpointer func, GPerlI11nInvocationInf
arg_info = g_callable_info_get_arg (invocation_info->interface,
(gint) invocation_info->current_pos);
dwarn (" C callback at %d (%s)\n",
dwarn ("C callback: pos = %d, name = %s\n",
invocation_info->current_pos,
g_base_info_get_name (arg_info));
......@@ -137,7 +137,7 @@ callback_to_sv (GICallableInfo *interface, gpointer func, GPerlI11nInvocationInf
}
callback_info->data_sv = data_sv;
dwarn (" C callback data at %d, destroy at %d\n",
dwarn (" data at %d, destroy at %d\n",
callback_info->data_pos, callback_info->destroy_pos);
......@@ -145,7 +145,7 @@ callback_to_sv (GICallableInfo *interface, gpointer func, GPerlI11nInvocationInf
g_slist_prepend (invocation_info->callback_infos,
callback_info);
dwarn (" returning C closure %p from info %p\n",
dwarn (" -> SV %p from info %p\n",
code_sv, callback_info);
return code_sv;
}
......@@ -160,7 +160,7 @@ callback_data_to_sv (gpointer data,
for (l = invocation_info->callback_infos; l != NULL; l = l->next) {
GPerlI11nCCallbackInfo *callback_info = l->data;
if (callback_info->data_pos == (gint) invocation_info->current_pos) {
dwarn (" user data for C callback %p\n",
dwarn ("user data for C callback %p\n",
callback_info);
attach_c_callback_data (callback_info, data);
return callback_info->data_sv;
......@@ -168,7 +168,7 @@ callback_data_to_sv (gpointer data,
}
if (data && invocation_info->is_callback) {
GPerlI11nPerlCallbackInfo *wrapper = data;
dwarn (" user data for Perl callback %p\n", wrapper);
dwarn ("user data for Perl callback %p\n", wrapper);
return wrapper->data;
}
return NULL;
......
......@@ -16,6 +16,8 @@ ghash_to_sv (GITypeInfo *info,
GHashTableIter iter;
HV *hv;
dwarn ("pointer = %p\n", pointer);
if (pointer == NULL) {
return &PL_sv_undef;
}
......@@ -32,10 +34,7 @@ ghash_to_sv (GITypeInfo *info,
value_type_tag = g_type_info_get_tag (value_param_info);
#endif
dwarn (" GHashTable: pointer %p\n"
" key type tag %d (%s)\n"
" value type tag %d (%s)\n",
pointer,
dwarn (" key tag = %d (%s), value tag = %d (%s)\n",
key_type_tag, g_type_tag_to_string (key_type_tag),
value_type_tag, g_type_tag_to_string (value_type_tag));
......@@ -46,13 +45,13 @@ ghash_to_sv (GITypeInfo *info,
GIArgument arg = { 0, };
SV *key_sv, *value_sv;
dwarn (" converting key pointer %p\n", key_p);
dwarn (" key pointer %p\n", key_p);
arg.v_pointer = key_p;
key_sv = arg_to_sv (&arg, key_param_info, item_transfer, NULL);
if (key_sv == NULL)
break;
dwarn (" converting value pointer %p\n", value_p);
dwarn (" value pointer %p\n", value_p);
arg.v_pointer = value_p;
value_sv = arg_to_sv (&arg, value_param_info, item_transfer, NULL);
if (value_sv == NULL)
......@@ -82,7 +81,7 @@ sv_to_ghash (GITransfer transfer,
GEqualFunc equal_func;
I32 n_keys;
dwarn ("%s: sv %p\n", G_STRFUNC, sv);
dwarn ("sv = %p\n", sv);
if (!gperl_sv_is_defined (sv))
return NULL;
......@@ -123,9 +122,7 @@ sv_to_ghash (GITransfer transfer,
break;
}
dwarn (" GHashTable with transfer %d\n"
" key_param_info %p with type tag %d (%s)\n"
" value_param_info %p with type tag %d (%s)\n",
dwarn (" transfer = %d, key info = %p, key tag = %d (%s), value info = %p, value tag = %d (%s)\n",
transfer,
key_param_info,
g_type_info_get_tag (key_param_info),
......@@ -148,8 +145,8 @@ sv_to_ghash (GITransfer transfer,
key_p = value_p = NULL;
sv = hv_iterkeysv (he);
dwarn (" key SV %p\n", sv);
if (sv && gperl_sv_is_defined (sv)) {
dwarn (" converting key SV %p\n", sv);
/* FIXME: Is it OK to always allow undef here? */
sv_to_arg (sv, &arg, NULL, key_param_info,
item_transfer, TRUE, NULL);
......@@ -157,8 +154,8 @@ sv_to_ghash (GITransfer transfer,
}
sv = hv_iterval (hv, he);
dwarn (" value SV %p\n", sv);
if (sv && gperl_sv_is_defined (sv)) {
dwarn (" converting value SV %p\n", sv);
sv_to_arg (sv, &arg, NULL, key_param_info,
item_transfer, TRUE, NULL);
value_p = arg.v_pointer;
......@@ -169,7 +166,7 @@ sv_to_ghash (GITransfer transfer,
}
out:
dwarn (" -> hash %p of size %d\n", hash, g_hash_table_size (hash));
dwarn (" -> hash %p of size %d\n", hash, g_hash_table_size (hash));
g_base_info_unref ((GIBaseInfo *) key_param_info);
g_base_info_unref ((GIBaseInfo *) value_param_info);
......
......@@ -13,15 +13,15 @@ instance_sv_to_pointer (GICallableInfo *info, SV *sv)
/* FIXME: Much of this code is duplicated in sv_to_interface. */
dwarn (" instance_sv_to_pointer: container name: %s, info type: %d\n",
dwarn ("container name = %s, info type = %d (%s)\n",
g_base_info_get_name (container),
info_type);
info_type, g_info_type_to_string (info_type));
switch (info_type) {
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
pointer = gperl_get_object (sv);
dwarn (" -> object pointer: %p\n", pointer);
dwarn (" -> object pointer: %p\n", pointer);
break;
case GI_INFO_TYPE_BOXED:
......@@ -30,22 +30,22 @@ instance_sv_to_pointer (GICallableInfo *info, SV *sv)
{
GType type = get_gtype ((GIRegisteredTypeInfo *) container);
if (!type || type == G_TYPE_NONE) {
dwarn (" unboxed type\n");
dwarn (" -> untyped record\n");
pointer = sv_to_struct (GI_TRANSFER_NOTHING,
container,
info_type,
sv);
} else {
dwarn (" boxed type: %s (%"G_GSIZE_FORMAT")\n",
dwarn (" -> boxed: type=%s (%"G_GSIZE_FORMAT")\n",
g_type_name (type), type);
pointer = gperl_get_boxed_check (sv, type);
}
dwarn (" -> boxed pointer: %p\n", pointer);
dwarn (" -> record pointer: %p\n", pointer);
break;
}
default:
ccroak ("instance_sv_to_pointer: Don't know how to handle info type %d", info_type);
ccroak ("Don't know how to handle info type %d for instance SV", info_type);
}
return pointer;
......@@ -64,15 +64,15 @@ instance_pointer_to_sv (GICallableInfo *info, gpointer pointer)
/* FIXME: Much of this code is duplicated in interface_to_sv. */
dwarn (" instance_pointer_to_sv: container name: %s, info type: %d\n",
dwarn ("container name = %s, info type = %d (%s)\n",
g_base_info_get_name (container),
info_type);
info_type, g_info_type_to_string (info_type));
switch (info_type) {
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
sv = gperl_new_object (pointer, FALSE);
dwarn (" -> object SV: %p\n", sv);