Fix: mi print of probe attributes + validation
authorJonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Thu, 28 Aug 2014 20:51:09 +0000 (16:51 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 3 Sep 2014 18:46:20 +0000 (14:46 -0400)
Signed-off-by: Jonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/mi-lttng.c
src/common/mi_lttng.xsd

index 83df149f2bc5c2eb9583ed22854bea70350c1cff..a250546d75bfe45d1c974725187ffef258d19eef 100644 (file)
@@ -914,6 +914,16 @@ int mi_lttng_event_function_probe(struct mi_writer *writer,
 {
        int ret;
 
 {
        int ret;
 
+       ret = mi_lttng_writer_open_element(writer, config_element_attributes);
+       if (ret) {
+               goto end;
+       }
+
+       ret = mi_lttng_writer_open_element(writer, config_element_probe_attributes);
+       if (ret) {
+               goto end;
+       }
+
        if (event->attr.probe.addr != 0) {
                /* event probe address */
                ret = mi_lttng_writer_write_element_unsigned_int(writer,
        if (event->attr.probe.addr != 0) {
                /* event probe address */
                ret = mi_lttng_writer_write_element_unsigned_int(writer,
@@ -936,6 +946,9 @@ int mi_lttng_event_function_probe(struct mi_writer *writer,
                        goto end;
                }
        }
                        goto end;
                }
        }
+
+       /* Close probe_attributes and attributes */
+       ret = mi_lttng_close_multi_element(writer, 2);
 end:
        return ret;
 }
 end:
        return ret;
 }
@@ -944,9 +957,29 @@ LTTNG_HIDDEN
 int mi_lttng_event_function_entry(struct mi_writer *writer,
                struct lttng_event *event)
 {
 int mi_lttng_event_function_entry(struct mi_writer *writer,
                struct lttng_event *event)
 {
+       int ret;
+
+       ret = mi_lttng_writer_open_element(writer, config_element_attributes);
+       if (ret) {
+               goto end;
+       }
+
+       ret = mi_lttng_writer_open_element(writer, config_element_probe_attributes);
+       if (ret) {
+               goto end;
+       }
+
        /* event probe symbol_name */
        /* event probe symbol_name */
-       return mi_lttng_writer_write_element_string(writer,
+       ret = mi_lttng_writer_write_element_string(writer,
                        config_element_symbol_name, event->attr.ftrace.symbol_name);
                        config_element_symbol_name, event->attr.ftrace.symbol_name);
+       if (ret) {
+               goto end;
+       }
+
+       /* Close function_attributes and attributes */
+       ret = mi_lttng_close_multi_element(writer, 2);
+end:
+       return ret;
 }
 
 LTTNG_HIDDEN
 }
 
 LTTNG_HIDDEN
@@ -976,6 +1009,8 @@ int mi_lttng_event(struct mi_writer *writer,
                }
                break;
        }
                }
                break;
        }
+       case LTTNG_EVENT_FUNCTION:
+               /* Fallthrough */
        case LTTNG_EVENT_PROBE:
                ret = mi_lttng_event_function_probe(writer, event);
                break;
        case LTTNG_EVENT_PROBE:
                ret = mi_lttng_event_function_probe(writer, event);
                break;
index d2cc5d4b8b334437e163b10a87f049a5584e283f..b115c6130654278fdc8ceda7d5e195ef187b02a4 100644 (file)
@@ -146,9 +146,9 @@ THE SOFTWARE.
        <!-- Maps to the lttng_event_probe_attr struct -->
        <xs:complexType name="event_probe_attributes_type">
                <xs:all>
        <!-- Maps to the lttng_event_probe_attr struct -->
        <xs:complexType name="event_probe_attributes_type">
                <xs:all>
-                       <xs:element name="address" type="uint64_type" />
-                       <xs:element name="offset" type="uint64_type" />
-                       <xs:element name="symbol_name" type="name_type" />
+                       <xs:element name="address" type="uint64_type" minOccurs="0" />
+                       <xs:element name="offset" type="uint64_type" minOccurs="0" />
+                       <xs:element name="symbol_name" type="name_type" minOccurs="0" />
                </xs:all>
        </xs:complexType>
 
                </xs:all>
        </xs:complexType>
 
This page took 0.028483 seconds and 5 git commands to generate.