X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-statedump.c;h=eac3e888df5ad668982cb20a1826a65482653397;hb=b653ddc1c1b44ad674265ebb749cfebd97be350e;hp=171cbaec0a666a83699d952cb31767c7ec3234bf;hpb=c362addf1c50e1d3202a26ff96738b71b4f9a531;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-statedump.c b/liblttng-ust/lttng-ust-statedump.c index 171cbaec..eac3e888 100644 --- a/liblttng-ust/lttng-ust-statedump.c +++ b/liblttng-ust/lttng-ust-statedump.c @@ -1,24 +1,11 @@ /* - * Copyright (C) 2013 Paul Woegerer - * Copyright (C) 2015 Antoine Busque - * Copyright (C) 2016 Mathieu Desnoyers + * SPDX-License-Identifier: LGPL-2.1-or-later * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (C) 2013 Paul Woegerer + * Copyright (C) 2015 Antoine Busque + * Copyright (C) 2016 Mathieu Desnoyers */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include @@ -30,10 +17,13 @@ #include #include -#include +#include #include "lttng-tracer-core.h" #include "lttng-ust-statedump.h" #include "jhash.h" +#include "getenv.h" +#include "compat.h" +#include "ust-events-internal.h" #define TRACEPOINT_DEFINE #include "ust_lib.h" /* Only define. */ @@ -203,7 +193,7 @@ void trace_statedump_event(tracepoint_cb tp_cb, void *owner, void *priv) struct cds_list_head *sessionsp; struct lttng_session *session; - sessionsp = _lttng_get_sessions(); + sessionsp = lttng_get_sessions(); cds_list_for_each_entry(session, sessionsp, node) { if (session->owner != owner) continue; @@ -245,6 +235,13 @@ void trace_debug_link_cb(struct lttng_session *session, void *priv) bin_data->dbg_file, bin_data->crc); } +static +void procname_cb(struct lttng_session *session, void *priv) +{ + char *procname = (char *) priv; + tracepoint(lttng_ust_statedump, procname, session, procname); +} + static void trace_start_cb(struct lttng_session *session, void *priv) { @@ -413,6 +410,8 @@ void iter_end(struct dl_iterate_data *data, void *ip) { unsigned int i; + if (data->cancel) + goto end; /* * Iterate on hash table. * For each marked, traced, do nothing. @@ -440,6 +439,7 @@ void iter_end(struct dl_iterate_data *data, void *ip) } } } +end: ust_unlock(); } @@ -548,7 +548,7 @@ void lttng_ust_dl_update(void *ip) { struct dl_iterate_data data; - if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) + if (lttng_ust_getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) return; /* @@ -582,13 +582,23 @@ void lttng_ust_dl_update(void *ip) static int do_baddr_statedump(void *owner) { - if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) + if (lttng_ust_getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) return 0; lttng_ust_dl_update(LTTNG_UST_CALLER_IP()); ust_dl_table_statedump(owner); return 0; } +static +int do_procname_statedump(void *owner) +{ + if (lttng_ust_getenv("LTTNG_UST_WITHOUT_PROCNAME_STATEDUMP")) + return 0; + + trace_statedump_event(procname_cb, owner, lttng_ust_sockinfo_get_procname(owner)); + return 0; +} + /* * Generate a statedump of a given traced application. A statedump is * delimited by start and end events. For a given (process, session) @@ -607,6 +617,7 @@ int do_lttng_ust_statedump(void *owner) trace_statedump_start(owner); ust_unlock(); + do_procname_statedump(owner); do_baddr_statedump(owner); ust_lock_nocheck();