mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-09 01:29:28 +00:00
fixes for debug output can someone tell me what debug_string is supposed to do ???
Original commit message from CVS: fixes for debug output can someone tell me what debug_string is supposed to do ???
This commit is contained in:
parent
fc455473cd
commit
dcf1cb131b
|
@ -140,7 +140,7 @@ const gchar *_gst_category_colors[32] = {
|
|||
/* [GST_CAT_TYPES] = */ "01;37;41", /* !! */
|
||||
/* [GST_CAT_XML] = */ "01;37;41", /* !! */
|
||||
/* [GST_CAT_NEGOTIATION] = */ "07;34",
|
||||
/* [GST_CAT_REFCOUNTING] = */ "00;34:42",
|
||||
/* [GST_CAT_REFCOUNTING] = */ "00;34;42",
|
||||
/* [GST_CAT_EVENT] = */ "01;37;41", /* !! */
|
||||
/* [GST_CAT_PARAMS] = */ "00;30;43", /* !! */
|
||||
"",
|
||||
|
@ -191,8 +191,8 @@ gst_default_debug_handler (gint category, gboolean incore,
|
|||
void *element, gchar *string)
|
||||
{
|
||||
gchar *empty = "";
|
||||
gchar *elementname = empty,*location = empty;
|
||||
int pid = getpid();
|
||||
gchar *elementname = empty,* location = empty;
|
||||
int pid = getpid ();
|
||||
int cothread_id = 0; /*FIXME*/
|
||||
#ifdef GST_DEBUG_COLOR
|
||||
int pid_color = pid%6 + 31;
|
||||
|
@ -201,28 +201,30 @@ gst_default_debug_handler (gint category, gboolean incore,
|
|||
|
||||
if (debug_string == NULL) debug_string = "";
|
||||
/* if (category != GST_CAT_GST_INIT) */
|
||||
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
|
||||
location = g_strdup_printf ("%s(%d): %s: %s:",
|
||||
file, line, function, debug_string);
|
||||
if (element && GST_IS_ELEMENT (element))
|
||||
#ifdef GST_DEBUG_COLOR
|
||||
elementname = g_strdup_printf (" \033[04m[%s]\033[00m", GST_OBJECT_NAME (element));
|
||||
elementname = g_strdup_printf (" \033[04m[%s]\033[00m",
|
||||
GST_OBJECT_NAME (element));
|
||||
#else
|
||||
elementname = g_strdup_printf (" [%s]", GST_OBJECT_NAME (element));
|
||||
#endif
|
||||
|
||||
#ifdef GST_DEBUG_COLOR
|
||||
fprintf(stderr,"DEBUG(\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
|
||||
"%s;%sm%s%s\033[00m %s\n",
|
||||
pid_color,pid,cothread_color,cothread_id,incore?"00":"01",
|
||||
_gst_category_colors[category],location,elementname,string);
|
||||
fprintf (stderr, "DEBUG(\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
|
||||
"%s;%sm%s%s\033[00m %s\n",
|
||||
pid_color, pid, cothread_color, cothread_id, incore ? "00" : "01",
|
||||
_gst_category_colors[category], location, elementname, string);
|
||||
#else
|
||||
fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s\n",
|
||||
pid,cothread_id,location,elementname,string);
|
||||
pid, cothread_id, location, elementname, string);
|
||||
#endif /* GST_DEBUG_COLOR */
|
||||
|
||||
if (location != empty) g_free(location);
|
||||
if (elementname != empty) g_free(elementname);
|
||||
if (location != empty) g_free (location);
|
||||
if (elementname != empty) g_free (elementname);
|
||||
|
||||
g_free(string);
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,14 +275,11 @@ gst_debug_disable_category (gint category) {
|
|||
_gst_debug_categories &= ~ (1 << category);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***** INFO system *****/
|
||||
GstInfoHandler _gst_info_handler = gst_default_info_handler;
|
||||
guint32 _gst_info_categories = 0x00000001;
|
||||
|
||||
|
||||
/* FIXME:what does debug_string DO ??? */
|
||||
/**
|
||||
* gst_default_info_handler:
|
||||
* @category: category of the INFO message
|
||||
|
@ -294,6 +293,7 @@ guint32 _gst_info_categories = 0x00000001;
|
|||
*
|
||||
* Prints out the INFO mesage in a variant of the following form:
|
||||
*
|
||||
* FIXME: description should be fixed
|
||||
* INFO:gst_function:542(args): [elementname] something neat happened
|
||||
*/
|
||||
void
|
||||
|
@ -303,8 +303,8 @@ gst_default_info_handler (gint category, gboolean incore,
|
|||
void *element, gchar *string)
|
||||
{
|
||||
gchar *empty = "";
|
||||
gchar *elementname = empty,*location = empty;
|
||||
int pid = getpid();
|
||||
gchar *elementname = empty, *location = empty;
|
||||
int pid = getpid ();
|
||||
int cothread_id = 0; /*FIXME*/
|
||||
#ifdef GST_DEBUG_COLOR
|
||||
int pid_color = pid%6 + 31;
|
||||
|
@ -313,21 +313,23 @@ gst_default_info_handler (gint category, gboolean incore,
|
|||
|
||||
if (debug_string == NULL) debug_string = "";
|
||||
if (category != GST_CAT_GST_INIT)
|
||||
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
|
||||
location = g_strdup_printf ("%s(%d): %s: %s:",
|
||||
file, line, function, debug_string);
|
||||
if (element && GST_IS_ELEMENT (element))
|
||||
elementname = g_strdup_printf (" \033[04m[%s]\033[00m", GST_OBJECT_NAME (element));
|
||||
elementname = g_strdup_printf (" \033[04m[%s]\033[00m",
|
||||
GST_OBJECT_NAME (element));
|
||||
|
||||
/*
|
||||
#ifdef GST_DEBUG_ENABLED
|
||||
*/
|
||||
#ifdef GST_DEBUG_COLOR
|
||||
fprintf(stderr,"\033[01mINFO\033[00m (\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
|
||||
GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n",
|
||||
pid_color,pid,cothread_color,cothread_id,
|
||||
_gst_category_colors[category],location,elementname,string);
|
||||
fprintf (stderr, "\033[01mINFO\033[00m (\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
|
||||
GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n",
|
||||
pid_color, pid, cothread_color, cothread_id,
|
||||
_gst_category_colors[category], location, elementname, string);
|
||||
#else
|
||||
fprintf(stderr,"INFO (%5d:%2d)%s%s %s\n",
|
||||
pid,cothread_id,location,elementname,string);
|
||||
fprintf (stderr, "INFO (%5d:%2d)%s%s %s\n",
|
||||
pid, cothread_id, location, elementname, string);
|
||||
#endif /* GST_DEBUG_COLOR */
|
||||
/*
|
||||
#else
|
||||
|
@ -342,10 +344,10 @@ gst_default_info_handler (gint category, gboolean incore,
|
|||
#endif
|
||||
*/
|
||||
|
||||
if (location != empty) g_free(location);
|
||||
if (elementname != empty) g_free(elementname);
|
||||
if (location != empty) g_free (location);
|
||||
if (elementname != empty) g_free (elementname);
|
||||
|
||||
g_free(string);
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,6 +485,7 @@ gst_default_error_handler (gchar *file, gchar *function,
|
|||
|
||||
/***** DEBUG system *****/
|
||||
#ifdef GST_DEBUG_ENABLED
|
||||
#ifdef GST_DEBUG_ENABLED
|
||||
GHashTable *__gst_function_pointers = NULL;
|
||||
/* FIXME make this thread specific */
|
||||
/* static GSList *stack_trace = NULL; */
|
||||
|
@ -502,6 +505,7 @@ _gst_debug_nameof_funcptr (void *ptr)
|
|||
return g_strdup_printf("%p",ptr);
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
*
|
||||
* gstinfo.h:
|
||||
* gstinfo.h:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -26,11 +26,28 @@
|
|||
#include <stdio.h>
|
||||
#include <gmodule.h>
|
||||
#include <unistd.h>
|
||||
#include <glib/gmacros.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* FIXME: convert to using G_STRLOC all the way if we can ! */
|
||||
|
||||
#ifndef FUNCTION
|
||||
#ifdef G_GNUC_PRETTY_FUNCTION
|
||||
#define FUNCTION G_GNUC_PRETTY_FUNCTION
|
||||
#elif HAVE_FUNC
|
||||
#define FUNCTION __func__
|
||||
#elif HAVE_PRETTY_FUNCTION
|
||||
#define FUNCTION __PRETTY_FUNCTION__
|
||||
#elif HAVE_FUNCTION
|
||||
#define FUNCTION __FUNCTION__
|
||||
#else
|
||||
#define FUNCTION ""
|
||||
#endif
|
||||
#endif /* ifndef FUNCTION */
|
||||
|
||||
/***** are we in the core or not? *****/
|
||||
#ifdef __GST_PRIVATE_H__
|
||||
#define _GST_DEBUG_INCORE TRUE
|
||||
|
@ -140,13 +157,13 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
|
|||
#ifdef GST_DEBUG_ENABLED
|
||||
#define GST_DEBUG(cat, ...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_debug_categories) \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
NULL,g_strdup_printf( __VA_ARGS__ )); \
|
||||
}G_STMT_END
|
||||
|
||||
#define GST_DEBUG_ELEMENT(cat, element, ...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_debug_categories) \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,g_strdup_printf( __VA_ARGS__ )); \
|
||||
}G_STMT_END
|
||||
|
||||
|
@ -160,13 +177,13 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
|
|||
#ifdef GST_DEBUG_ENABLED
|
||||
#define GST_DEBUG(cat,format,args...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_debug_categories) \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
NULL,g_strdup_printf( format , ## args )); \
|
||||
}G_STMT_END
|
||||
|
||||
#define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_debug_categories) \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,g_strdup_printf( format , ## args )); \
|
||||
}G_STMT_END
|
||||
|
||||
|
@ -351,13 +368,13 @@ extern guint32 _gst_info_categories;
|
|||
#ifdef GST_INFO_ENABLED
|
||||
#define GST_INFO(cat,...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_info_categories) \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
NULL,g_strdup_printf( __VA_ARGS__ )); \
|
||||
}G_STMT_END
|
||||
|
||||
#define GST_INFO_ELEMENT(cat,element,...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_info_categories) \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,g_strdup_printf( __VA_ARGS__ )); \
|
||||
}G_STMT_END
|
||||
|
||||
|
@ -371,13 +388,13 @@ extern guint32 _gst_info_categories;
|
|||
#ifdef GST_INFO_ENABLED
|
||||
#define GST_INFO(cat,format,args...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_info_categories) \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
NULL,g_strdup_printf( format , ## args )); \
|
||||
}G_STMT_END
|
||||
|
||||
#define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
|
||||
if ((1<<cat) & _gst_info_categories) \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,g_strdup_printf( format , ## args )); \
|
||||
}G_STMT_END
|
||||
|
||||
|
@ -419,21 +436,21 @@ extern GstErrorHandler _gst_error_handler;
|
|||
#ifdef G_HAVE_ISO_VARARGS
|
||||
|
||||
#define GST_ERROR(element,...) \
|
||||
_gst_error_handler(__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,NULL,g_strdup_printf( __VA_ARGS__ ))
|
||||
|
||||
#define GST_ERROR_OBJECT(element,object,...) \
|
||||
_gst_error_handler(__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,object,g_strdup_printf( __VA_ARGS__ ))
|
||||
|
||||
#elif defined(G_HAVE_GNUC_VARARGS)
|
||||
|
||||
#define GST_ERROR(element,format,args...) \
|
||||
_gst_error_handler(__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,NULL,g_strdup_printf( format , ## args ))
|
||||
|
||||
#define GST_ERROR_OBJECT(element,object,format,args...) \
|
||||
_gst_error_handler(__FILE__,G_GNUC_PRETTY_FUNCTION,__LINE__,_debug_string, \
|
||||
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
||||
element,object,g_strdup_printf( format , ## args ))
|
||||
|
||||
#endif
|
||||
|
@ -445,24 +462,27 @@ extern GstErrorHandler _gst_error_handler;
|
|||
extern GHashTable *__gst_function_pointers;
|
||||
|
||||
|
||||
#ifdef GST_DEBUG_ENABLED
|
||||
#if GST_DEBUG_ENABLED
|
||||
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
|
||||
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
|
||||
#else
|
||||
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
|
||||
#define GST_DEBUG_FUNCPTR_NAME(ptr) ""
|
||||
#endif
|
||||
|
||||
static inline void *
|
||||
_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
|
||||
_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
|
||||
{
|
||||
if (!__gst_function_pointers) __gst_function_pointers = g_hash_table_new(g_direct_hash,g_direct_equal);
|
||||
if (!g_hash_table_lookup(__gst_function_pointers,ptr))
|
||||
g_hash_table_insert(__gst_function_pointers,ptr,ptrname);
|
||||
return ptr;
|
||||
}
|
||||
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
|
||||
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
|
||||
|
||||
gchar * _gst_debug_nameof_funcptr (void *ptr);
|
||||
#else
|
||||
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
|
||||
#define GST_DEBUG_FUNCPTR_NAME(ptr) ""
|
||||
#endif
|
||||
gchar *_gst_debug_nameof_funcptr (void *ptr);
|
||||
|
||||
void gst_debug_print_stack_trace (void);
|
||||
|
||||
|
||||
|
||||
#endif /* __GSTINFO_H__ */
|
||||
|
|
Loading…
Reference in a new issue