server: Always print the full path of objects when dumping them.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-21 21:08:56 +09:00
parent 110b53affc
commit d15f47412e
14 changed files with 35 additions and 64 deletions

View File

@ -102,9 +102,7 @@ static void completion_dump( struct object *obj, int verbose )
struct completion *completion = (struct completion *) obj; struct completion *completion = (struct completion *) obj;
assert( obj->ops == &completion_ops ); assert( obj->ops == &completion_ops );
fprintf( stderr, "Completion " ); fprintf( stderr, "Completion depth=%u", completion->depth );
dump_object_name( &completion->obj );
fprintf( stderr, " (%u packets pending)\n", completion->depth );
} }
static struct object_type *completion_get_type( struct object *obj ) static struct object_type *completion_get_type( struct object *obj )

View File

@ -314,11 +314,7 @@ static void set_irp_result( struct irp_call *irp, unsigned int status,
static void device_dump( struct object *obj, int verbose ) static void device_dump( struct object *obj, int verbose )
{ {
struct device *device = (struct device *)obj; fputs( "Device\n", stderr );
fprintf( stderr, "Device " );
dump_object_name( &device->obj );
fputc( '\n', stderr );
} }
static struct object_type *device_get_type( struct object *obj ) static struct object_type *device_get_type( struct object *obj )

View File

@ -108,11 +108,7 @@ static struct directory *dir_objtype;
static void object_type_dump( struct object *obj, int verbose ) static void object_type_dump( struct object *obj, int verbose )
{ {
assert( obj->ops == &object_type_ops ); fputs( "Object type\n", stderr );
fputs( "Object type ", stderr );
dump_object_name( obj );
fputc( '\n', stderr );
} }
static struct object_type *object_type_get_type( struct object *obj ) static struct object_type *object_type_get_type( struct object *obj )
@ -124,11 +120,7 @@ static struct object_type *object_type_get_type( struct object *obj )
static void directory_dump( struct object *obj, int verbose ) static void directory_dump( struct object *obj, int verbose )
{ {
assert( obj->ops == &directory_ops ); fputs( "Directory\n", stderr );
fputs( "Directory ", stderr );
dump_object_name( obj );
fputc( '\n', stderr );
} }
static struct object_type *directory_get_type( struct object *obj ) static struct object_type *directory_get_type( struct object *obj )

View File

@ -153,10 +153,8 @@ static void event_dump( struct object *obj, int verbose )
{ {
struct event *event = (struct event *)obj; struct event *event = (struct event *)obj;
assert( obj->ops == &event_ops ); assert( obj->ops == &event_ops );
fprintf( stderr, "Event manual=%d signaled=%d ", fprintf( stderr, "Event manual=%d signaled=%d\n",
event->manual_reset, event->signaled ); event->manual_reset, event->signaled );
dump_object_name( &event->obj );
fputc( '\n', stderr );
} }
static struct object_type *event_get_type( struct object *obj ) static struct object_type *event_get_type( struct object *obj )
@ -230,11 +228,7 @@ struct keyed_event *get_keyed_event_obj( struct process *process, obj_handle_t h
static void keyed_event_dump( struct object *obj, int verbose ) static void keyed_event_dump( struct object *obj, int verbose )
{ {
struct keyed_event *event = (struct keyed_event *)obj; fputs( "Keyed event\n", stderr );
assert( obj->ops == &keyed_event_ops );
fprintf( stderr, "Keyed event " );
dump_object_name( &event->obj );
fputc( '\n', stderr );
} }
static struct object_type *keyed_event_get_type( struct object *obj ) static struct object_type *keyed_event_get_type( struct object *obj )

View File

@ -153,6 +153,7 @@ static void handle_table_dump( struct object *obj, int verbose )
if (!entry->ptr) continue; if (!entry->ptr) continue;
fprintf( stderr, " %04x: %p %08x ", fprintf( stderr, " %04x: %p %08x ",
index_to_handle(i), entry->ptr, entry->access ); index_to_handle(i), entry->ptr, entry->access );
dump_object_name( entry->ptr );
entry->ptr->ops->dump( entry->ptr, 0 ); entry->ptr->ops->dump( entry->ptr, 0 );
} }
} }

View File

@ -325,8 +325,7 @@ static void mailslot_queue_async( struct fd *fd, const async_data_t *data, int t
static void mailslot_device_dump( struct object *obj, int verbose ) static void mailslot_device_dump( struct object *obj, int verbose )
{ {
assert( obj->ops == &mailslot_device_ops ); fputs( "Mailslot device\n", stderr );
fprintf( stderr, "Mail slot device\n" );
} }
static struct object_type *mailslot_device_get_type( struct object *obj ) static struct object_type *mailslot_device_get_type( struct object *obj )

View File

@ -604,12 +604,10 @@ static void mapping_dump( struct object *obj, int verbose )
struct mapping *mapping = (struct mapping *)obj; struct mapping *mapping = (struct mapping *)obj;
assert( obj->ops == &mapping_ops ); assert( obj->ops == &mapping_ops );
fprintf( stderr, "Mapping size=%08x%08x prot=%08x fd=%p header_size=%08x base=%08lx " fprintf( stderr, "Mapping size=%08x%08x prot=%08x fd=%p header_size=%08x base=%08lx "
"shared_file=%p ", "shared_file=%p\n",
(unsigned int)(mapping->size >> 32), (unsigned int)mapping->size, (unsigned int)(mapping->size >> 32), (unsigned int)mapping->size,
mapping->protect, mapping->fd, mapping->header_size, mapping->protect, mapping->fd, mapping->header_size,
(unsigned long)mapping->base, mapping->shared_file ); (unsigned long)mapping->base, mapping->shared_file );
dump_object_name( &mapping->obj );
fputc( '\n', stderr );
} }
static struct object_type *mapping_get_type( struct object *obj ) static struct object_type *mapping_get_type( struct object *obj )

View File

@ -138,9 +138,7 @@ static void mutex_dump( struct object *obj, int verbose )
{ {
struct mutex *mutex = (struct mutex *)obj; struct mutex *mutex = (struct mutex *)obj;
assert( obj->ops == &mutex_ops ); assert( obj->ops == &mutex_ops );
fprintf( stderr, "Mutex count=%u owner=%p ", mutex->count, mutex->owner ); fprintf( stderr, "Mutex count=%u owner=%p\n", mutex->count, mutex->owner );
dump_object_name( &mutex->obj );
fputc( '\n', stderr );
} }
static struct object_type *mutex_get_type( struct object *obj ) static struct object_type *mutex_get_type( struct object *obj )

View File

@ -269,11 +269,7 @@ static const struct fd_ops named_pipe_device_fd_ops =
static void named_pipe_dump( struct object *obj, int verbose ) static void named_pipe_dump( struct object *obj, int verbose )
{ {
struct named_pipe *pipe = (struct named_pipe *) obj; fputs( "Named pipe\n", stderr );
assert( obj->ops == &named_pipe_ops );
fprintf( stderr, "Named pipe " );
dump_object_name( &pipe->obj );
fprintf( stderr, "\n" );
} }
static unsigned int named_pipe_map_access( struct object *obj, unsigned int access ) static unsigned int named_pipe_map_access( struct object *obj, unsigned int access )
@ -443,8 +439,7 @@ static void pipe_client_destroy( struct object *obj)
static void named_pipe_device_dump( struct object *obj, int verbose ) static void named_pipe_device_dump( struct object *obj, int verbose )
{ {
assert( obj->ops == &named_pipe_device_ops ); fputs( "Named pipe device\n", stderr );
fprintf( stderr, "Named pipe device\n" );
} }
static struct object_type *named_pipe_device_get_type( struct object *obj ) static struct object_type *named_pipe_device_get_type( struct object *obj )

View File

@ -68,12 +68,14 @@ void dump_objects(void)
{ {
struct object *ptr = LIST_ENTRY( p, struct object, obj_list ); struct object *ptr = LIST_ENTRY( p, struct object, obj_list );
fprintf( stderr, "%p:%d: ", ptr, ptr->refcount ); fprintf( stderr, "%p:%d: ", ptr, ptr->refcount );
dump_object_name( ptr );
ptr->ops->dump( ptr, 1 ); ptr->ops->dump( ptr, 1 );
} }
LIST_FOR_EACH( p, &object_list ) LIST_FOR_EACH( p, &object_list )
{ {
struct object *ptr = LIST_ENTRY( p, struct object, obj_list ); struct object *ptr = LIST_ENTRY( p, struct object, obj_list );
fprintf( stderr, "%p:%d: ", ptr, ptr->refcount ); fprintf( stderr, "%p:%d: ", ptr, ptr->refcount );
dump_object_name( ptr );
ptr->ops->dump( ptr, 1 ); ptr->ops->dump( ptr, 1 );
} }
} }
@ -267,16 +269,24 @@ void *create_named_object( struct namespace *namespace, const struct object_ops
return obj; return obj;
} }
/* recursive helper for dump_object_name */
static void dump_name( struct object *obj )
{
struct object_name *name = obj->name;
if (!name) return;
if (name->parent) dump_name( name->parent );
fputs( "\\\\", stderr );
dump_strW( name->name, name->len / sizeof(WCHAR), stderr, "[]" );
}
/* dump the name of an object to stderr */ /* dump the name of an object to stderr */
void dump_object_name( struct object *obj ) void dump_object_name( struct object *obj )
{ {
if (!obj->name) fprintf( stderr, "name=\"\"" ); if (!obj->name) return;
else fputc( '[', stderr );
{ dump_name( obj );
fprintf( stderr, "name=L\"" ); fputs( "] ", stderr );
dump_strW( obj->name->name, obj->name->len/sizeof(WCHAR), stderr, "\"\"" );
fputc( '\"', stderr );
}
} }
/* unlink a named object from its namespace, without freeing the object itself */ /* unlink a named object from its namespace, without freeing the object itself */

View File

@ -124,9 +124,7 @@ static void semaphore_dump( struct object *obj, int verbose )
{ {
struct semaphore *sem = (struct semaphore *)obj; struct semaphore *sem = (struct semaphore *)obj;
assert( obj->ops == &semaphore_ops ); assert( obj->ops == &semaphore_ops );
fprintf( stderr, "Semaphore count=%d max=%d ", sem->count, sem->max ); fprintf( stderr, "Semaphore count=%d max=%d\n", sem->count, sem->max );
dump_object_name( &sem->obj );
fputc( '\n', stderr );
} }
static struct object_type *semaphore_get_type( struct object *obj ) static struct object_type *semaphore_get_type( struct object *obj )

View File

@ -77,11 +77,9 @@ static void symlink_dump( struct object *obj, int verbose )
struct symlink *symlink = (struct symlink *)obj; struct symlink *symlink = (struct symlink *)obj;
assert( obj->ops == &symlink_ops ); assert( obj->ops == &symlink_ops );
fprintf( stderr, "Symlink " ); fputs( "Symlink target=\"", stderr );
dump_object_name( obj );
fprintf( stderr, " -> L\"" );
dump_strW( symlink->target, symlink->len / sizeof(WCHAR), stderr, "\"\"" ); dump_strW( symlink->target, symlink->len / sizeof(WCHAR), stderr, "\"\"" );
fprintf( stderr, "\"\n" ); fputs( "\"\n", stderr );
} }
static struct object_type *symlink_get_type( struct object *obj ) static struct object_type *symlink_get_type( struct object *obj )

View File

@ -184,10 +184,8 @@ static void timer_dump( struct object *obj, int verbose )
{ {
struct timer *timer = (struct timer *)obj; struct timer *timer = (struct timer *)obj;
assert( obj->ops == &timer_ops ); assert( obj->ops == &timer_ops );
fprintf( stderr, "Timer manual=%d when=%s period=%u ", fprintf( stderr, "Timer manual=%d when=%s period=%u\n",
timer->manual, get_timeout_str(timer->when), timer->period ); timer->manual, get_timeout_str(timer->when), timer->period );
dump_object_name( &timer->obj );
fputc( '\n', stderr );
} }
static struct object_type *timer_get_type( struct object *obj ) static struct object_type *timer_get_type( struct object *obj )

View File

@ -133,10 +133,8 @@ static void winstation_dump( struct object *obj, int verbose )
{ {
struct winstation *winstation = (struct winstation *)obj; struct winstation *winstation = (struct winstation *)obj;
fprintf( stderr, "Winstation flags=%x clipboard=%p atoms=%p ", fprintf( stderr, "Winstation flags=%x clipboard=%p atoms=%p\n",
winstation->flags, winstation->clipboard, winstation->atom_table ); winstation->flags, winstation->clipboard, winstation->atom_table );
dump_object_name( &winstation->obj );
fputc( '\n', stderr );
} }
static struct object_type *winstation_get_type( struct object *obj ) static struct object_type *winstation_get_type( struct object *obj )
@ -223,10 +221,8 @@ static void desktop_dump( struct object *obj, int verbose )
{ {
struct desktop *desktop = (struct desktop *)obj; struct desktop *desktop = (struct desktop *)obj;
fprintf( stderr, "Desktop flags=%x winstation=%p top_win=%p hooks=%p ", fprintf( stderr, "Desktop flags=%x winstation=%p top_win=%p hooks=%p\n",
desktop->flags, desktop->winstation, desktop->top_window, desktop->global_hooks ); desktop->flags, desktop->winstation, desktop->top_window, desktop->global_hooks );
dump_object_name( &desktop->obj );
fputc( '\n', stderr );
} }
static struct object_type *desktop_get_type( struct object *obj ) static struct object_type *desktop_get_type( struct object *obj )