Commit c250844e authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/control/rc/rc.c: 'l' outputs a list of all allocated objects,

    just as 'd' displayed a tree of attached objects.
  * ./src/misc/modules.c: added a missing header.
parent 2f1be4f3
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition. * vlc_objects.h: vlc_object_t definition.
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.7 2002/08/12 22:12:50 massiot Exp $ * $Id: vlc_objects.h,v 1.8 2002/08/14 08:17:24 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -58,6 +58,7 @@ VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) ); ...@@ -58,6 +58,7 @@ VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
//VLC_EXPORT( void, __vlc_object_setchild, ( vlc_object_t *, vlc_object_t * ) ); //VLC_EXPORT( void, __vlc_object_setchild, ( vlc_object_t *, vlc_object_t * ) );
#endif #endif
VLC_EXPORT( void, __vlc_liststructure, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
#define vlc_object_create(a,b) \ #define vlc_object_create(a,b) \
...@@ -87,6 +88,9 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) ); ...@@ -87,6 +88,9 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
__vlc_object_setchild( VLC_OBJECT(a), VLC_OBJECT(b) ) __vlc_object_setchild( VLC_OBJECT(a), VLC_OBJECT(b) )
#endif #endif
#define vlc_liststructure(a) \
__vlc_liststructure( VLC_OBJECT(a) )
#define vlc_dumpstructure(a) \ #define vlc_dumpstructure(a) \
__vlc_dumpstructure( VLC_OBJECT(a) ) __vlc_dumpstructure( VLC_OBJECT(a) )
...@@ -92,6 +92,7 @@ struct module_symbols_t ...@@ -92,6 +92,7 @@ struct module_symbols_t
void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ; void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ;
void (* __msg_Warn_inner) ( void *, const char *, ... ) ; void (* __msg_Warn_inner) ( void *, const char *, ... ) ;
void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ; void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ;
void (* __vlc_liststructure_inner) ( vlc_object_t * ) ;
void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ; void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ; void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ;
void (* __vlc_object_detach_inner) ( vlc_object_t * ) ; void (* __vlc_object_detach_inner) ( vlc_object_t * ) ;
...@@ -187,6 +188,7 @@ struct module_symbols_t ...@@ -187,6 +188,7 @@ struct module_symbols_t
# define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner # define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner
# define __vlc_cond_init p_symbols->__vlc_cond_init_inner # define __vlc_cond_init p_symbols->__vlc_cond_init_inner
# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner # define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner
# define __vlc_liststructure p_symbols->__vlc_liststructure_inner
# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner # define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner
# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner # define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner
# define __vlc_object_attach p_symbols->__vlc_object_attach_inner # define __vlc_object_attach p_symbols->__vlc_object_attach_inner
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rc.c : remote control stdin/stdout plugin for vlc * rc.c : remote control stdin/stdout plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: rc.c,v 1.2 2002/08/13 13:15:14 sigmunau Exp $ * $Id: rc.c,v 1.3 2002/08/14 08:17:24 sam Exp $
* *
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at> * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
* *
...@@ -216,6 +216,11 @@ static void Run( intf_thread_t *p_intf ) ...@@ -216,6 +216,11 @@ static void Run( intf_thread_t *p_intf )
} }
break; break;
case 'l':
case 'L':
vlc_liststructure( p_intf->p_vlc );
break;
case 'd': case 'd':
case 'D': case 'D':
vlc_dumpstructure( p_intf->p_vlc ); vlc_dumpstructure( p_intf->p_vlc );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions * modules.c : Builtin and plugin modules management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.84 2002/08/12 22:12:51 massiot Exp $ * $Id: modules.c,v 1.85 2002/08/14 08:17:24 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com> * Ethan C. Baldridge <BaldridgeE@cadmus.com>
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#include "video_output.h" #include "video_output.h"
#include "audio_output.h" #include "audio_output.h"
#include "aout_internal.h"
#include "stream_output.h" #include "stream_output.h"
......
...@@ -303,6 +303,7 @@ static const char * module_error( char *psz_buffer ) ...@@ -303,6 +303,7 @@ static const char * module_error( char *psz_buffer )
(p_symbols)->__vlc_object_release_inner = __vlc_object_release; \ (p_symbols)->__vlc_object_release_inner = __vlc_object_release; \
(p_symbols)->__vlc_object_detach_inner = __vlc_object_detach; \ (p_symbols)->__vlc_object_detach_inner = __vlc_object_detach; \
(p_symbols)->__vlc_object_attach_inner = __vlc_object_attach; \ (p_symbols)->__vlc_object_attach_inner = __vlc_object_attach; \
(p_symbols)->__vlc_liststructure_inner = __vlc_liststructure; \
(p_symbols)->__vlc_dumpstructure_inner = __vlc_dumpstructure; \ (p_symbols)->__vlc_dumpstructure_inner = __vlc_dumpstructure; \
(p_symbols)->playlist_Command_inner = playlist_Command; \ (p_symbols)->playlist_Command_inner = playlist_Command; \
(p_symbols)->playlist_Add_inner = playlist_Add; \ (p_symbols)->playlist_Add_inner = playlist_Add; \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling * objects.c: vlc_object_t handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.16 2002/08/12 09:34:15 sam Exp $ * $Id: objects.c,v 1.17 2002/08/14 08:17:24 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -507,28 +507,8 @@ static void set_attachment_flag( vlc_object_t *p_this, vlc_bool_t b_attached ) ...@@ -507,28 +507,8 @@ static void set_attachment_flag( vlc_object_t *p_this, vlc_bool_t b_attached )
p_this->b_attached = b_attached; p_this->b_attached = b_attached;
} }
/***************************************************************************** static void vlc_print_object( vlc_object_t *p_this, const char *psz_prefix )
* vlc_dumpstructure: print the current vlc structure
*****************************************************************************
* This function prints an ASCII tree showing the connections between vlc
* objects, and additional information such as their refcount, thread ID,
* address, etc.
*****************************************************************************/
void __vlc_dumpstructure( vlc_object_t *p_this )
{ {
char psz_foo[2 * MAX_DUMPSTRUCTURE_DEPTH + 1];
vlc_mutex_lock( &p_this->p_vlc->structure_lock );
psz_foo[0] = '|';
vlc_dumpstructure_inner( p_this, 0, psz_foo );
vlc_mutex_unlock( &p_this->p_vlc->structure_lock );
}
static void vlc_dumpstructure_inner( vlc_object_t *p_this,
int i_level, char *psz_foo )
{
int i;
char i_back = psz_foo[i_level];
char psz_children[20], psz_refcount[20], psz_thread[20], psz_name[50]; char psz_children[20], psz_refcount[20], psz_thread[20], psz_name[50];
psz_name[0] = '\0'; psz_name[0] = '\0';
...@@ -568,9 +548,71 @@ static void vlc_dumpstructure_inner( vlc_object_t *p_this, ...@@ -568,9 +548,71 @@ static void vlc_dumpstructure_inner( vlc_object_t *p_this,
psz_thread[19] = '\0'; psz_thread[19] = '\0';
} }
msg_Info( p_this->p_vlc, "%so %.6x %s%s%s%s%s", psz_prefix,
p_this->i_object_id, p_this->psz_object_type,
psz_name, psz_thread, psz_refcount, psz_children );
}
/*****************************************************************************
* vlc_liststructure: print the current vlc objects
*****************************************************************************
* This function prints an ASCII tree showing the connections between vlc
* objects, and additional information such as their refcount, thread ID,
* address, etc.
*****************************************************************************/
void __vlc_liststructure( vlc_object_t *p_this )
{
vlc_object_t ** p_all;
vlc_object_t * p_current;
int i_total;
vlc_mutex_lock( &p_this->p_vlc->structure_lock );
i_total = p_this->p_vlc->i_objects;
p_all = p_this->p_vlc->pp_objects;
for( p_current = p_all[0] ; p_current < p_all[i_total] ; p_current++ )
{
if( p_current->b_attached )
{
vlc_print_object( p_current, "" );
}
else
{
msg_Info( p_this->p_vlc, "o %.6x %s (not attached)",
p_current->i_object_id, p_current->psz_object_type );
}
}
vlc_mutex_unlock( &p_this->p_vlc->structure_lock );
}
/*****************************************************************************
* vlc_dumpstructure: print the current vlc structure
*****************************************************************************
* This function prints an ASCII tree showing the connections between vlc
* objects, and additional information such as their refcount, thread ID,
* address, etc.
*****************************************************************************/
void __vlc_dumpstructure( vlc_object_t *p_this )
{
char psz_foo[2 * MAX_DUMPSTRUCTURE_DEPTH + 1];
vlc_mutex_lock( &p_this->p_vlc->structure_lock );
psz_foo[0] = '|';
vlc_dumpstructure_inner( p_this, 0, psz_foo );
vlc_mutex_unlock( &p_this->p_vlc->structure_lock );
}
static void vlc_dumpstructure_inner( vlc_object_t *p_this,
int i_level, char *psz_foo )
{
int i;
char i_back = psz_foo[i_level];
psz_foo[i_level] = '\0'; psz_foo[i_level] = '\0';
msg_Info( p_this, "%so %s %p%s%s%s%s", psz_foo, p_this->psz_object_type,
p_this, psz_name, psz_thread, psz_refcount, psz_children ); vlc_print_object( p_this, psz_foo );
psz_foo[i_level] = i_back; psz_foo[i_level] = i_back;
if( i_level / 2 >= MAX_DUMPSTRUCTURE_DEPTH ) if( i_level / 2 >= MAX_DUMPSTRUCTURE_DEPTH )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment