}
static
-struct ctf_callsite *ctf_trace_callsite_lookup(struct ctf_trace *trace,
+struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace,
GQuark callsite_name)
{
return g_hash_table_lookup(trace->callsites,
dom_print = 1;
}
if ((opt_callsite_field || opt_all_fields)) {
+ struct ctf_callsite_dups *cs_dups;
struct ctf_callsite *callsite;
- callsite = ctf_trace_callsite_lookup(stream_class->trace,
+ cs_dups = ctf_trace_callsite_lookup(stream_class->trace,
event_class->name);
- if (callsite) {
+ if (cs_dups) {
+ int i = 0;
+
set_field_names_print(pos, ITEM_HEADER);
if (pos->print_names) {
fprintf(pos->fp, "callsite = ");
} else if (dom_print) {
fprintf(pos->fp, ":");
}
- fprintf(pos->fp, "[%s@%s:%" PRIu64 "]",
- callsite->func, callsite->file,
- callsite->line);
+ fprintf(pos->fp, "[");
+ bt_list_for_each_entry(callsite, &cs_dups->head, node) {
+ if (i != 0)
+ fprintf(pos->fp, ",");
+ fprintf(pos->fp, "%s@%s:%" PRIu64 "",
+ callsite->func, callsite->file,
+ callsite->line);
+ i++;
+ }
+ fprintf(pos->fp, "]");
if (pos->print_names)
fprintf(pos->fp, ", ");
dom_print = 1;
int ret = 0;
struct ctf_node *iter;
struct ctf_callsite *callsite;
+ struct ctf_callsite_dups *cs_dups;
callsite = g_new0(struct ctf_callsite, 1);
bt_list_for_each_entry(iter, &node->u.callsite.declaration_list, siblings) {
goto error;
}
- g_hash_table_insert(trace->callsites, (gpointer) (unsigned long) callsite->name, callsite);
+ cs_dups = g_hash_table_lookup(trace->callsites,
+ (gpointer) (unsigned long) callsite->name);
+ if (!cs_dups) {
+ cs_dups = g_new0(struct ctf_callsite_dups, 1);
+ BT_INIT_LIST_HEAD(&cs_dups->head);
+ g_hash_table_insert(trace->callsites,
+ (gpointer) (unsigned long) callsite->name, cs_dups);
+ }
+ bt_list_add_tail(&callsite->node, &cs_dups->head);
return 0;
error:
static
void callsite_free(gpointer data)
{
- struct ctf_callsite *callsite = data;
+ struct ctf_callsite_dups *cs_dups = data;
+ struct ctf_callsite *callsite, *cs_n;
- g_free(callsite->func);
- g_free(callsite->file);
- g_free(callsite);
+ bt_list_for_each_entry_safe(callsite, cs_n, &cs_dups->head, node) {
+ g_free(callsite->func);
+ g_free(callsite->file);
+ g_free(callsite);
+ }
}
static
char *func;
char *file;
uint64_t line;
+ struct bt_list_head node;
enum { /* Fields populated mask */
CTF_CALLSITE_name = (1U << 0),
CTF_CALLSITE_func = (1U << 1),
} field_mask;
};
+struct ctf_callsite_dups {
+ struct bt_list_head head;
+};
+
#define CTF_TRACE_SET_FIELD(ctf_trace, field) \
do { \
(ctf_trace)->field_mask |= CTF_TRACE_ ## field; \