summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2008-08-07 22:02:58 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-07 22:02:58 +0000
commitb39decb0f236d3e8d725197137543801a861ac1d (patch)
treefe1eaf91be7eb50f210042df59d1c351f92a2e75
parentfe771ac38090a71d6eb7ac257ded1044c0904b15 (diff)
downloadgobject-introspection-b39decb0f236d3e8d725197137543801a861ac1d.tar.gz
Improve debugging, remove leading g prefix from typenames
svn path=/branches/gir-compiler/; revision=322
-rw-r--r--tools/compiler.c13
-rw-r--r--tools/girnode.c55
-rw-r--r--tools/girparser.c28
3 files changed, 66 insertions, 30 deletions
diff --git a/tools/compiler.c b/tools/compiler.c
index 0b60ea47..4fff88dc 100644
--- a/tools/compiler.c
+++ b/tools/compiler.c
@@ -190,6 +190,8 @@ main (int argc, char ** argv)
return 1;
}
+ g_debug ("[parsing] start");
+
modules = NULL;
for (i = 0; input[i]; i++)
{
@@ -207,6 +209,10 @@ main (int argc, char ** argv)
modules = g_list_concat (modules, mods);
}
+ g_debug ("[parsing] done");
+
+ g_debug ("[building] start");
+
for (m = modules; m; m = m->next)
{
GIrModule *module = m->data;
@@ -221,6 +227,9 @@ main (int argc, char ** argv)
g_free (module->shared_library);
module->shared_library = g_strdup (shlib);
}
+
+ g_debug ("[building] module %s", module->name);
+
metadata = g_ir_module_build_metadata (module, modules);
if (metadata == NULL)
{
@@ -249,6 +258,8 @@ main (int argc, char ** argv)
break;
}
}
-
+
+ g_debug ("[building] done");
+
return 0;
}
diff --git a/tools/girnode.c b/tools/girnode.c
index 35f37cb0..5e33a398 100644
--- a/tools/girnode.c
+++ b/tools/girnode.c
@@ -585,11 +585,13 @@ g_ir_node_get_size (GIrNode *node)
break;
default:
- g_error ("Unhandled node type %d\n", node->type);
+ g_error ("Unhandled node type '%s'\n",
+ g_ir_node_type_to_string (node->type));
size = 0;
}
- g_debug ("node %p type %d size %d", node, node->type, size);
+ g_debug ("node %p type '%s' size %d", node,
+ g_ir_node_type_to_string (node->type), size);
return size;
}
@@ -603,7 +605,7 @@ g_ir_node_get_full_size (GIrNode *node)
g_assert (node != NULL);
- g_debug ("node %p type %s\n", node,
+ g_debug ("node %p type '%s'", node,
g_ir_node_type_to_string (node->type));
switch (node->type)
@@ -649,7 +651,7 @@ g_ir_node_get_full_size (GIrNode *node)
size = 4;
else
{
- g_debug ("node %p type tag %s\n", node,
+ g_debug ("node %p type tag '%s'", node,
gi_type_tag_to_string (type->tag));
switch (type->tag)
@@ -875,7 +877,8 @@ g_ir_node_get_full_size (GIrNode *node)
size = 0;
}
- g_debug ("node %p type %d full size %d", node, node->type, size);
+ g_debug ("node %p type '%s' full size %d", node,
+ g_ir_node_type_to_string (node->type), size);
return size;
}
@@ -1088,23 +1091,23 @@ serialize_type (GIrModule *module,
gint i;
const gchar* basic[] = {
"void",
- "gboolean",
- "gint8",
- "guint8",
- "gint16",
- "guint16",
- "gint32",
- "guint32",
- "gint64",
- "guint64",
- "gint",
- "guint",
- "glong",
- "gulong",
- "gssize",
- "gsize",
- "gfloat",
- "gdouble",
+ "boolean",
+ "int8",
+ "uint8",
+ "int16",
+ "uint16",
+ "int32",
+ "uint32",
+ "int64",
+ "uint64",
+ "int",
+ "uint",
+ "long",
+ "ulong",
+ "ssize",
+ "size",
+ "float",
+ "double",
"utf8",
"filename"
};
@@ -1209,7 +1212,8 @@ g_ir_node_build_metadata (GIrNode *node,
g_assert (node != NULL);
- g_debug ("build_medatadata(%s)\n", g_ir_node_type_to_string (node->type));
+ g_debug ("build_metadata (%s)",
+ g_ir_node_type_to_string (node->type));
switch (node->type)
{
@@ -2155,8 +2159,9 @@ g_ir_node_build_metadata (GIrNode *node,
g_assert_not_reached ();
}
- g_debug ("node %p type %d, offset %d -> %d, offset2 %d -> %d",
- node, node->type, old_offset, *offset, old_offset2, *offset2);
+ g_debug ("node %p type '%s', offset %d -> %d, offset2 %d -> %d",
+ node, g_ir_node_type_to_string (node->type),
+ old_offset, *offset, old_offset2, *offset2);
if (*offset2 - old_offset2 + *offset - old_offset > g_ir_node_get_full_size (node))
g_error ("exceeding space reservation !!");
diff --git a/tools/girparser.c b/tools/girparser.c
index d21e630a..c8235364 100644
--- a/tools/girparser.c
+++ b/tools/girparser.c
@@ -119,7 +119,6 @@ find_attribute (const gchar *name,
static void
state_switch (ParseContext *ctx, ParseState newstate)
{
- fprintf (stderr, "state %d -> %d\n", ctx->state, newstate);
ctx->prev_state = ctx->state;
ctx->state = newstate;
}
@@ -1668,6 +1667,8 @@ start_discriminator (GMarkupParseContext *context,
return FALSE;
}
+extern GLogLevelFlags logged_levels;
+
static void
start_element_handler (GMarkupParseContext *context,
const gchar *element_name,
@@ -1678,9 +1679,24 @@ start_element_handler (GMarkupParseContext *context,
{
ParseContext *ctx = user_data;
gint line_number, char_number;
-#if 0
- g_printerr ("element-name: '%s'\n", element_name);
-#endif
+
+ if (logged_levels & G_LOG_LEVEL_DEBUG)
+ {
+ GString *tags = g_string_new ("");
+ int i;
+ for (i = 0; attribute_names[i]; i++)
+ g_string_append_printf (tags, "%s=\"%s\" ",
+ attribute_names[i],
+ attribute_values[i]);
+
+ if (i)
+ {
+ g_string_insert_c (tags, 0, ' ');
+ g_string_truncate (tags, tags->len - 1);
+ }
+ g_debug ("<%s%s>", element_name, tags->str);
+ g_string_free (tags, TRUE);
+ }
switch (element_name[0])
{
@@ -2005,6 +2021,8 @@ end_element_handler (GMarkupParseContext *context,
{
ParseContext *ctx = user_data;
+ g_debug ("</%s>", element_name);
+
switch (ctx->state)
{
case STATE_START:
@@ -2280,6 +2298,8 @@ g_ir_parse_file (const gchar *filename,
gsize length;
GList *modules;
+ g_debug ("[parsing] filename %s", filename);
+
if (!g_file_get_contents (filename, &buffer, &length, error))
return NULL;