/* CTF format support.
- Copyright (C) 2012-2018 Free Software Foundation, Inc.
+ Copyright (C) 2012-2019 Free Software Foundation, Inc.
Contributed by Hui Zhu <hui_zhu@mentor.com>
Contributed by Yao Qi <yao@codesourcery.com>
#include "tracefile.h"
#include <ctype.h>
#include <algorithm>
-#include "common/filestuff.h"
+#include "gdbsupport/filestuff.h"
+#include "gdbarch.h"
/* The CTF target. */
/* condition */
if (tp->cond != NULL)
- ctf_save_write (&writer->tcs, (gdb_byte *) tp->cond, strlen (tp->cond));
+ ctf_save_write (&writer->tcs, (gdb_byte *) tp->cond.get (),
+ strlen (tp->cond.get ()));
ctf_save_write (&writer->tcs, &zero, 1);
/* actions */
u32 = tp->actions.size ();
ctf_save_align_write (&writer->tcs, (gdb_byte *) &u32, 4, 4);
- for (char *act : tp->actions)
- ctf_save_write (&writer->tcs, (gdb_byte *) act, strlen (act) + 1);
+ for (const auto &act : tp->actions)
+ ctf_save_write (&writer->tcs, (gdb_byte *) act.get (),
+ strlen (act.get ()) + 1);
/* step_actions */
u32 = tp->step_actions.size ();
ctf_save_align_write (&writer->tcs, (gdb_byte *) &u32, 4, 4);
- for (char *act : tp->step_actions)
- ctf_save_write (&writer->tcs, (gdb_byte *) act, strlen (act) + 1);
+ for (const auto &act : tp->step_actions)
+ ctf_save_write (&writer->tcs, (gdb_byte *) act.get (),
+ strlen (act.get ()) + 1);
/* at_string */
if (tp->at_string != NULL)
- ctf_save_write (&writer->tcs, (gdb_byte *) tp->at_string,
- strlen (tp->at_string));
+ ctf_save_write (&writer->tcs, (gdb_byte *) tp->at_string.get (),
+ strlen (tp->at_string.get ()));
ctf_save_write (&writer->tcs, &zero, 1);
/* cond_string */
if (tp->cond_string != NULL)
- ctf_save_write (&writer->tcs, (gdb_byte *) tp->cond_string,
- strlen (tp->cond_string));
+ ctf_save_write (&writer->tcs, (gdb_byte *) tp->cond_string.get (),
+ strlen (tp->cond_string.get ()));
ctf_save_write (&writer->tcs, &zero, 1);
/* cmd_strings */
u32 = tp->cmd_strings.size ();
ctf_save_align_write (&writer->tcs, (gdb_byte *) &u32, 4, 4);
- for (char *act : tp->cmd_strings)
- ctf_save_write (&writer->tcs, (gdb_byte *) act, strlen (act) + 1);
+ for (const auto &act : tp->cmd_strings)
+ ctf_save_write (&writer->tcs, (gdb_byte *) act.get (),
+ strlen (act.get ()) + 1);
}
const struct bt_definition *element \
= bt_ctf_get_index ((EVENT), def, i); \
\
- (VAR)->ARRAY.push_back \
+ (VAR)->ARRAY.emplace_back \
(xstrdup (bt_ctf_get_string (element))); \
} \
} \
#FIELD)); \
\
if (strlen (p) > 0) \
- (VAR)->FIELD = xstrdup (p); \
+ (VAR)->FIELD.reset (xstrdup (p)); \
else \
(VAR)->FIELD = NULL; \
} \