summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f6c7740)
unsigned long attributes;
int static_offset; /* boolean - private - is the field offset statically
* known with the preceding types ? */
unsigned long attributes;
int static_offset; /* boolean - private - is the field offset statically
* known with the preceding types ? */
};
static inline GQuark marker_field_get_name(struct marker_field *field)
};
static inline GQuark marker_field_get_name(struct marker_field *field)
__attribute__((no_instrument_function))
static inline const char *parse_c_type(struct marker_info *info,
const char *fmt,
__attribute__((no_instrument_function))
static inline const char *parse_c_type(struct marker_info *info,
const char *fmt,
- char *c_size, enum ltt_type *c_type)
+ char *c_size, enum ltt_type *c_type, GString *field_fmt)
{
int qualifier; /* 'h', 'l', or 'L' for integer fields */
/* 'z' support added 23/7/1999 S.H. */
{
int qualifier; /* 'h', 'l', or 'L' for integer fields */
/* 'z' support added 23/7/1999 S.H. */
case ' ':
case '#':
case '0':
case ' ':
case '#':
case '0':
+ g_string_append_c(field_fmt, *fmt);
++fmt;
if (qualifier == 'l' && *fmt == 'l') {
qualifier = 'L';
++fmt;
if (qualifier == 'l' && *fmt == 'l') {
qualifier = 'L';
+ g_string_append_c(field_fmt, *fmt);
case 'c':
*c_type = LTT_TYPE_UNSIGNED_INT;
*c_size = sizeof(unsigned char);
case 'c':
*c_type = LTT_TYPE_UNSIGNED_INT;
*c_size = sizeof(unsigned char);
+ g_string_append_c(field_fmt, *fmt);
goto parse_end;
case 's':
*c_type = LTT_TYPE_STRING;
goto parse_end;
case 's':
*c_type = LTT_TYPE_STRING;
case 'd':
case 'i':
*c_type = LTT_TYPE_SIGNED_INT;
case 'd':
case 'i':
*c_type = LTT_TYPE_SIGNED_INT;
+ g_string_append_c(field_fmt, 'l');
+ g_string_append_c(field_fmt, 'l');
+ g_string_append_c(field_fmt, *fmt);
break;
case 'o':
case 'u':
case 'x':
case 'X':
break;
case 'o':
case 'u':
case 'x':
case 'X':
+ g_string_append_c(field_fmt, 'l');
+ g_string_append_c(field_fmt, 'l');
+ g_string_append_c(field_fmt, *fmt);
*c_type = LTT_TYPE_UNSIGNED_INT;
break;
default:
*c_type = LTT_TYPE_UNSIGNED_INT;
break;
default:
long offset, const char *name,
char trace_size, enum ltt_type trace_type,
char c_size, enum ltt_type c_type, unsigned long attributes,
long offset, const char *name,
char trace_size, enum ltt_type trace_type,
char c_size, enum ltt_type c_type, unsigned long attributes,
- unsigned int field_count)
+ unsigned int field_count, GString *field_fmt)
{
struct marker_field *field;
char tmpname[MAX_NAME_LEN];
{
struct marker_field *field;
char tmpname[MAX_NAME_LEN];
field->name = g_quark_from_string(tmpname);
}
field->type = trace_type;
field->name = g_quark_from_string(tmpname);
}
field->type = trace_type;
+ field->fmt = g_string_new(field_fmt->str);
switch (trace_type) {
case LTT_TYPE_SIGNED_INT:
switch (trace_type) {
case LTT_TYPE_SIGNED_INT:
const char *name_begin = NULL, *name_end = NULL;
char *name = NULL;
unsigned int field_count = 1;
const char *name_begin = NULL, *name_end = NULL;
char *name = NULL;
unsigned int field_count = 1;
+ GString *field_fmt = g_string_new("");
name_begin = fmt;
for (; *fmt ; ++fmt) {
name_begin = fmt;
for (; *fmt ; ++fmt) {
case '#':
/* tracetypes (#) */
++fmt; /* skip first '#' */
case '#':
/* tracetypes (#) */
++fmt; /* skip first '#' */
- if (*fmt == '#') /* Escaped ## */
+ if (*fmt == '#') { /* Escaped ## */
+ g_string_append_c(field_fmt, *fmt);
+ g_string_append_c(field_fmt, *fmt);
attributes = 0;
fmt = parse_trace_type(info, fmt, &trace_size, &trace_type,
&attributes);
break;
case '%':
/* c types (%) */
attributes = 0;
fmt = parse_trace_type(info, fmt, &trace_size, &trace_type,
&attributes);
break;
case '%':
/* c types (%) */
+ g_string_append_c(field_fmt, *fmt);
++fmt; /* skip first '%' */
++fmt; /* skip first '%' */
- if (*fmt == '%') /* Escaped %% */
+ if (*fmt == '%') { /* Escaped %% */
+ g_string_append_c(field_fmt, *fmt);
- fmt = parse_c_type(info, fmt, &c_size, &c_type);
+ }
+ fmt = parse_c_type(info, fmt, &c_size, &c_type, field_fmt);
/*
* Output c types if no trace types has been
* specified.
/*
* Output c types if no trace types has been
* specified.
trace_type = LTT_TYPE_STRING;
/* perform trace write */
offset = add_type(info, offset, name, trace_size,
trace_type = LTT_TYPE_STRING;
/* perform trace write */
offset = add_type(info, offset, name, trace_size,
- trace_type, c_size, c_type, attributes, field_count++);
+ trace_type, c_size, c_type, attributes, field_count++,
+ field_fmt);
+ g_string_truncate(field_fmt, 0);
trace_size = c_size = 0;
trace_type = c_size = LTT_TYPE_NONE;
trace_size = c_size = 0;
trace_type = c_size = LTT_TYPE_NONE;
+ g_string_truncate(field_fmt, 0);
attributes = 0;
name_begin = NULL;
if (name) {
attributes = 0;
name_begin = NULL;
if (name) {
+ g_string_truncate(field_fmt, 0);
if (!name_end && name_begin) {
name_end = fmt;
if (name)
if (!name_end && name_begin) {
name_end = fmt;
if (name)
}
break; /* Skip white spaces */
default:
}
break; /* Skip white spaces */
default:
+ g_string_append_c(field_fmt, *fmt);
if (!name_begin) {
name_begin = fmt;
name_end = NULL;
if (!name_begin) {
name_begin = fmt;
name_end = NULL;
info->size = offset;
if (name)
g_free(name);
info->size = offset;
if (name)
g_free(name);
+ g_string_free(field_fmt, TRUE);
}
int marker_parse_format(const char *format, struct marker_info *info)
}
int marker_parse_format(const char *format, struct marker_info *info)
void destroy_marker_data(LttTrace *trace)
{
void destroy_marker_data(LttTrace *trace)
{
struct marker_info *info;
struct marker_info *info;
+ struct marker_field *field;
for (i=0; i<trace->markers->len; i++) {
info = &g_array_index(trace->markers, struct marker_info, i);
for (i=0; i<trace->markers->len; i++) {
info = &g_array_index(trace->markers, struct marker_info, i);
+ if (info->fields) {
+ for (j = 0; j < info->fields->len; j++) {
+ field = &g_array_index(info->fields, struct marker_field, j);
+ g_string_free(field->fmt, TRUE);
+ }
g_array_free(info->fields, TRUE);
g_array_free(info->fields, TRUE);
}
g_array_free(trace->markers, TRUE);
g_hash_table_destroy(trace->markers_hash);
}
g_array_free(trace->markers, TRUE);
g_hash_table_destroy(trace->markers_hash);
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
value = ltt_event_get_long_int(e,f);
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
value = ltt_event_get_long_int(e,f);
- g_string_append_printf(s, "%lld", value);
+ //g_string_append_printf(s, "%lld", value);
+ g_string_append_printf(s, f->fmt->str, value);
//g_string_append_printf(s, type->fmt, ltt_event_get_long_int(e,f));
print_enum_events(e, f, value, s, tfs);
break;
//g_string_append_printf(s, type->fmt, ltt_event_get_long_int(e,f));
print_enum_events(e, f, value, s, tfs);
break;
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
value = ltt_event_get_long_unsigned(e,f);
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
value = ltt_event_get_long_unsigned(e,f);
- g_string_append_printf(s, "%llu", value);
+ //g_string_append_printf(s, "%llu", value);
+ g_string_append_printf(s, f->fmt->str, value);
print_enum_events(e, f, value, s, tfs);
//g_string_append_printf(s, type->fmt, ltt_event_get_long_unsigned(e,f));
break;
print_enum_events(e, f, value, s, tfs);
//g_string_append_printf(s, type->fmt, ltt_event_get_long_unsigned(e,f));
break;