[sysprof/wip/chergert/sysprof-3] kallsyms: allow creating from kallsyms data
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] kallsyms: allow creating from kallsyms data
- Date: Thu, 9 May 2019 23:33:45 +0000 (UTC)
commit 056733d6274a936b02369ad7affbef04753486b0
Author: Christian Hergert <chergert redhat com>
Date: Thu May 9 16:31:16 2019 -0700
kallsyms: allow creating from kallsyms data
src/libsysprof/sysprof-kallsyms.c | 22 ++++++++++++++++++----
src/libsysprof/sysprof-kallsyms.h | 14 ++++++++------
2 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/src/libsysprof/sysprof-kallsyms.c b/src/libsysprof/sysprof-kallsyms.c
index c6080c5..965d1cc 100644
--- a/src/libsysprof/sysprof-kallsyms.c
+++ b/src/libsysprof/sysprof-kallsyms.c
@@ -50,6 +50,20 @@ sysprof_kallsyms_free (SysprofKallsyms *self)
}
}
+SysprofKallsyms *
+sysprof_kallsyms_new_take (gchar *data)
+{
+ g_autoptr(SysprofKallsyms) self = NULL;
+
+ self = g_slice_new0 (SysprofKallsyms);
+ self->buf = g_steal_pointer (&data);
+ self->buflen = strlen (self->buf);
+ self->endptr = self->buf + self->buflen;
+ self->iter = self->buf;
+
+ return g_steal_pointer (&self);
+}
+
SysprofKallsyms *
sysprof_kallsyms_new (const gchar *path)
{
@@ -70,10 +84,10 @@ sysprof_kallsyms_new (const gchar *path)
}
gboolean
-sysprof_kallsyms_next (SysprofKallsyms *self,
- const gchar **name,
- guint64 *address,
- guint8 *type)
+sysprof_kallsyms_next (SysprofKallsyms *self,
+ const gchar **name,
+ guint64 *address,
+ guint8 *type)
{
guint64 addr;
char *tok;
diff --git a/src/libsysprof/sysprof-kallsyms.h b/src/libsysprof/sysprof-kallsyms.h
index 9ae011f..1778f5b 100644
--- a/src/libsysprof/sysprof-kallsyms.h
+++ b/src/libsysprof/sysprof-kallsyms.h
@@ -27,14 +27,16 @@ G_BEGIN_DECLS
typedef struct _SysprofKallsyms SysprofKallsyms;
SYSPROF_AVAILABLE_IN_ALL
-SysprofKallsyms *sysprof_kallsyms_new (const gchar *path);
+SysprofKallsyms *sysprof_kallsyms_new (const gchar *path);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sysprof_kallsyms_next (SysprofKallsyms *self,
- const gchar **name,
- guint64 *address,
- guint8 *type);
+SysprofKallsyms *sysprof_kallsyms_new_take (gchar *data);
SYSPROF_AVAILABLE_IN_ALL
-void sysprof_kallsyms_free (SysprofKallsyms *self);
+gboolean sysprof_kallsyms_next (SysprofKallsyms *self,
+ const gchar **name,
+ guint64 *address,
+ guint8 *type);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_kallsyms_free (SysprofKallsyms *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofKallsyms, sysprof_kallsyms_free)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]