[lttng-dev] [PATCH v2] mi: Fix event attributes printing under attributes element
Jonathan Rajotte Julien
jonathan.r.julien at gmail.com
Wed Aug 27 16:51:50 EDT 2014
The event attributes (symbol name, address, and offset) where not
printed under the good element. Furthermore the xsd semantic was invalid
on attributes validation
Signed-off-by: Jonathan Rajotte Julien <jonathan.r.julien at gmail.com>
---
src/common/mi-lttng.c | 23 ++++++++++++++++++++++-
src/common/mi_lttng.xsd | 23 ++++-------------------
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/src/common/mi-lttng.c b/src/common/mi-lttng.c
index 83df149..1f8c4ee 100644
--- a/src/common/mi-lttng.c
+++ b/src/common/mi-lttng.c
@@ -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
diff --git a/src/common/mi_lttng.xsd b/src/common/mi_lttng.xsd
index d2cc5d4..3ffcfb9 100644
--- a/src/common/mi_lttng.xsd
+++ b/src/common/mi_lttng.xsd
@@ -143,30 +143,15 @@ 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">
+ <!-- Maps to per event type configuration -->
+ <xs:complexType name="event_attributes_type">
<xs:all>
<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: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:complexType>
-
<!-- Maps to exclusion type -->
<xs:complexType name="event_exclusion_list_type">
<xs:sequence>
--
2.0.4
More information about the lttng-dev
mailing list