Skip to contentSkip to conversation

mi: Fix event attributes printing under attributes element

PATCH Jonathan Rajotte 1 participant 1 message Aug 27, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

These patch are not good and should not be considered. The xsd was valid and based on the previous work from libconfig should stay that way to maintain similiarity with the output from the save command. The mi need a patch to comply with the xsd. I'll send it tomorrow ....

Sorry for the spam

Quoted 101 lines · Jonathan Rajotte Julien

The event attributes (symbol name, address, and offset) where not printed under the good element. Furthermore the xsd semantic was invalid on attributes validation

---
 src/common/mi-lttng.c   | 23 ++++++++++++++++++++++-
 src/common/mi_lttng.xsd | 25 +++++--------------------
 2 files changed, 27 insertions(+), 21 deletions(-)
src/common/mi-lttng.c +22 -1
index 83df149..1f8c4ee 100644
@@ -914,6 +914,11 @@ int mi_lttng_event_function_probe(struct mi_writer *writer,
 {
        int ret;
 
+       ret = mi_lttng_writer_open_element(writer, config_element_attributes);
+       if (ret) {
+               goto end;
+       }
+
        if (event->attr.probe.addr != 0) {
                /* event probe address */
                ret = mi_lttng_writer_write_element_unsigned_int(writer,
@@ -936,6 +941,8 @@ int mi_lttng_event_function_probe(struct mi_writer *writer,
                        goto end;
                }
        }
+
+       ret = mi_lttng_writer_close_element(writer);
 end:
        return ret;
 }
@@ -944,9 +951,23 @@ LTTNG_HIDDEN
 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;
+       }
+
        /* 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);
+       if (ret) {
+               goto end;
+       }
+
+       ret = mi_lttng_writer_close_element(writer);
+end:
+       return ret;
 }
 
 LTTNG_HIDDEN
src/common/mi_lttng.xsd +5 -21
index d2cc5d4..f9e784a 100644
@@ -143,28 +143,13 @@ THE SOFTWARE.
                </xs:restriction>
        </xs:simpleType>
 
-       <!-- 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:all>
-       </xs:complexType>
-
-       <!-- Maps to the lttng_event_function_attr struct -->
-       <xs:complexType name="event_ftrace_attributes_type">
-               <xs:all>
-                       <xs:element name="symbol_name" type="name_type" />
-               </xs:all>
-       </xs:complexType>
-
        <!-- Maps to per event type configuration -->
        <xs:complexType name="event_attributes_type">
-               <xs:choice>
-                       <xs:element name="probe_attributes" type="event_probe_attributes_type" />
-                       <xs:element name="function_attributes" type="event_ftrace_attributes_type" />
-               </xs:choice>
+               <xs:all>
+                       <xs:element name="symbol_name" type="name_type" minOccurs="0" />
+                       <xs:element name="address" type="uint64_type" minOccurs="0" />
+                       <xs:element name="offset" type="uint64_type" minOccurs="0" />
+               </xs:all>
        </xs:complexType>
 
        <!-- Maps to exclusion type -->
--

2.0.4

Signature · 8 lines
Jonathan Rajotte Julien
Chargé de laboratoire, INF1995
Polytechnique Montréal

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev