callsite: support instruction pointer field
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 16 Oct 2012 02:04:42 +0000 (22:04 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 16 Oct 2012 02:04:42 +0000 (22:04 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf-text/ctf-text.c
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
include/babeltrace/ctf-ir/metadata.h

index 67400f513c7fffad32ac89ea96050679e4df3fa0..40f2f008c5ad12d853b08c958e17b2f4309821bc 100644 (file)
@@ -427,9 +427,15 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition *
                        bt_list_for_each_entry(callsite, &cs_dups->head, node) {
                                if (i != 0)
                                        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);
+                               if (CTF_CALLSITE_FIELD_IS_SET(callsite, ip)) {
+                                       fprintf(pos->fp, "%s@0x%" PRIx64 ":%s:%" PRIu64 "",
+                                               callsite->func, callsite->ip, callsite->file,
+                                               callsite->line);
+                               } else {
+                                       fprintf(pos->fp, "%s:%s:%" PRIu64 "",
+                                               callsite->func, callsite->file,
+                                               callsite->line);
+                               }
                                i++;
                        }
                        fprintf(pos->fp, "]");
                                i++;
                        }
                        fprintf(pos->fp, "]");
index 9be7e161a237f27c0e57eb8bf6d4edab6d72a09d..de9986113de508f36bfe66ac5950c6786da728ef 100644 (file)
@@ -2507,6 +2507,19 @@ int ctf_callsite_declaration_visit(FILE *fd, int depth, struct ctf_node *node,
                                goto error;
                        }
                        CTF_CALLSITE_SET_FIELD(callsite, line);
                                goto error;
                        }
                        CTF_CALLSITE_SET_FIELD(callsite, line);
+               } else if (!strcmp(left, "ip")) {
+                       if (CTF_CALLSITE_FIELD_IS_SET(callsite, ip)) {
+                               fprintf(fd, "[error] %s: ip already declared in callsite declaration\n", __func__);
+                               ret = -EPERM;
+                               goto error;
+                       }
+                       ret = get_unary_unsigned(&node->u.ctf_expression.right, &callsite->ip);
+                       if (ret) {
+                               fprintf(fd, "[error] %s: unexpected unary expression for callsite ip\n", __func__);
+                               ret = -EINVAL;
+                               goto error;
+                       }
+                       CTF_CALLSITE_SET_FIELD(callsite, ip);
                } else {
                        fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in callsite declaration.\n", __func__, left);
                }
                } else {
                        fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in callsite declaration.\n", __func__, left);
                }
index 8e0eb0542fc49ac2a76e5965a259396e58a137a1..e5c3240c5e039d1620cb240d6d38a034c3772b27 100644 (file)
@@ -121,12 +121,14 @@ struct ctf_callsite {
        char *func;
        char *file;
        uint64_t line;
        char *func;
        char *file;
        uint64_t line;
+       uint64_t ip;
        struct bt_list_head node;
        enum {                                  /* Fields populated mask */
                CTF_CALLSITE_name       =       (1U << 0),
                CTF_CALLSITE_func       =       (1U << 1),
                CTF_CALLSITE_file       =       (1U << 2),
                CTF_CALLSITE_line       =       (1U << 3),
        struct bt_list_head node;
        enum {                                  /* Fields populated mask */
                CTF_CALLSITE_name       =       (1U << 0),
                CTF_CALLSITE_func       =       (1U << 1),
                CTF_CALLSITE_file       =       (1U << 2),
                CTF_CALLSITE_line       =       (1U << 3),
+               CTF_CALLSITE_ip         =       (1U << 4),
        } field_mask;
 };
 
        } field_mask;
 };
 
This page took 0.036837 seconds and 4 git commands to generate.