improve debug

This commit is contained in:
Wim Taymans 2019-08-01 14:55:44 +02:00
parent 4048a730e0
commit 7614604250
5 changed files with 28 additions and 15 deletions

View file

@ -142,7 +142,9 @@ void pw_device_destroy(struct pw_device *device)
spa_hook_remove(&device->global_listener);
pw_global_destroy(device->global);
}
pw_log_debug(NAME" %p: free", device);
pw_device_emit_free(device);
free((char *)device->info.name);
pw_properties_free(device->properties);

View file

@ -32,6 +32,8 @@
#include "pipewire/interfaces.h"
#include "pipewire/keys.h"
#define NAME "factory"
#define pw_factory_resource_info(r,...) pw_resource_call(r,struct pw_factory_proxy_events,info,0,__VA_ARGS__)
struct resource_data {
@ -64,7 +66,7 @@ struct pw_factory *pw_factory_new(struct pw_core *core,
if (user_data_size > 0)
this->user_data = SPA_MEMBER(this, sizeof(*this), void);
pw_log_debug("factory %p: new %s", this, name);
pw_log_debug(NAME" %p: new %s", this, name);
return this;
}
@ -72,7 +74,7 @@ struct pw_factory *pw_factory_new(struct pw_core *core,
SPA_EXPORT
void pw_factory_destroy(struct pw_factory *factory)
{
pw_log_debug("factory %p: destroy", factory);
pw_log_debug(NAME" %p: destroy", factory);
pw_factory_emit_destroy(factory);
if (factory->registered)
@ -82,6 +84,8 @@ void pw_factory_destroy(struct pw_factory *factory)
spa_hook_remove(&factory->global_listener);
pw_global_destroy(factory->global);
}
pw_log_debug(NAME" %p: free", factory);
free((char *)factory->info.name);
if (factory->properties)
pw_properties_free(factory->properties);
@ -116,7 +120,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
data = pw_resource_get_user_data(resource);
pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
pw_log_debug("factory %p: bound to %d", this, resource->id);
pw_log_debug(NAME" %p: bound to %d", this, resource->id);
spa_list_append(&global->resource_list, &resource->link);
@ -127,7 +131,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
return 0;
error_resource:
pw_log_error("can't create factory resource: %m");
pw_log_error(NAME" %p: can't create factory resource: %m", this);
return -errno;
}

View file

@ -40,6 +40,8 @@
#include "pipewire/module.h"
#include "pipewire/type.h"
#define NAME "module"
/** \cond */
struct impl {
struct pw_module this;
@ -134,7 +136,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
data = pw_resource_get_user_data(resource);
pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
pw_log_debug("module %p: bound to %d", this, resource->id);
pw_log_debug(NAME" %p: bound to %d", this, resource->id);
spa_list_append(&global->resource_list, &resource->link);
@ -145,7 +147,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
return 0;
error_resource:
pw_log_error("can't create module resource: %m");
pw_log_error(NAME" %p: can't create module resource: %m", this);
return -errno;
}
@ -268,7 +270,7 @@ pw_module_load(struct pw_core *core,
pw_global_register(this->global, owner, parent);
pw_log_debug("loaded module: %s", this->info.name);
pw_log_debug(NAME" %p: loaded module: %s", this, this->info.name);
return this;
@ -320,7 +322,7 @@ void pw_module_destroy(struct pw_module *module)
{
struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this);
pw_log_debug("module %p: destroy", module);
pw_log_debug(NAME" %p: destroy", module);
pw_module_emit_destroy(module);
if (module->global) {
@ -329,6 +331,7 @@ void pw_module_destroy(struct pw_module *module)
pw_global_destroy(module->global);
}
pw_log_debug(NAME" %p: destroy", module);
free((char *) module->info.name);
free((char *) module->info.filename);
free((char *) module->info.args);
@ -336,7 +339,7 @@ void pw_module_destroy(struct pw_module *module)
pw_properties_free(module->properties);
if (dlclose(impl->hnd) != 0)
pw_log_warn("dlclose failed: %s", dlerror());
pw_log_warn(NAME" %p: dlclose failed: %s", module, dlerror());
free(impl);
}
@ -367,7 +370,7 @@ int pw_module_update_properties(struct pw_module *module, const struct spa_dict
changed = pw_properties_update(module->properties, dict);
pw_log_debug("module %p: updated %d properties", module, changed);
pw_log_debug(NAME" %p: updated %d properties", module, changed);
if (!changed)
return 0;

View file

@ -32,6 +32,8 @@
#include <spa/debug/types.h>
#define NAME "proxy"
/** \cond */
struct proxy {
struct pw_proxy this;
@ -71,7 +73,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
this->marshal = pw_protocol_get_marshal(remote->conn->protocol, type);
if (this->marshal == NULL) {
pw_log_error("proxy %p: no marshal for type %d", this, type);
pw_log_error(NAME" %p: no marshal for type %d", this, type);
res = -EPROTO;
goto error_clean;
}
@ -79,7 +81,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
this->id = pw_map_insert_new(&remote->objects, this);
if (this->id == SPA_ID_INVALID) {
res = -errno;
pw_log_error("proxy %p: can't allocate new id: %m", this);
pw_log_error(NAME" %p: can't allocate new id: %m", this);
goto error_clean;
}
@ -96,7 +98,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
spa_list_append(&this->remote->proxy_list, &this->link);
pw_log_debug("proxy %p: new %u %s remote %p, marshal %p",
pw_log_debug(NAME" %p: new %u %s remote %p, marshal %p",
this, this->id,
spa_debug_type_find_name(pw_type_info(), type),
remote, this->marshal);
@ -159,7 +161,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this);
struct pw_remote *remote = proxy->remote;
pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
pw_log_debug(NAME" %p: destroy %u", proxy, proxy->id);
pw_proxy_emit_destroy(proxy);
spa_list_remove(&proxy->link);
@ -173,6 +175,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
if (remote->core_proxy)
pw_core_proxy_destroy(remote->core_proxy, proxy);
}
pw_log_debug(NAME" %p: free", proxy);
free(impl);
}
@ -184,7 +187,7 @@ int pw_proxy_sync(struct pw_proxy *proxy, int seq)
if (remote->core_proxy != NULL) {
res = pw_core_proxy_sync(remote->core_proxy, proxy->id, seq);
pw_log_debug("proxy %p: %u seq:%d sync %u", proxy, proxy->id, seq, res);
pw_log_debug(NAME" %p: %u seq:%d sync %u", proxy, proxy->id, seq, res);
}
return res;
}

View file

@ -1235,6 +1235,7 @@ void pw_stream_destroy(struct pw_stream *stream)
clear_params(stream, PARAM_TYPE_INIT | PARAM_TYPE_OTHER | PARAM_TYPE_FORMAT);
pw_log_debug(NAME" %p: free", stream);
free(stream->error);
pw_properties_free(stream->properties);