libsysprof: stub out source for appending symbols

This commit is contained in:
Christian Hergert
2019-05-27 20:57:07 -07:00
parent 8a246d4453
commit 90c165aa08
4 changed files with 130 additions and 0 deletions

View File

@ -19,6 +19,7 @@ libsysprof_public_sources = [
'sysprof-source.c',
'sysprof-symbol-dirs.c',
'sysprof-symbol-resolver.c',
'sysprof-symbols-source.c',
'sysprof-tracefd-source.c',
]
@ -41,6 +42,7 @@ libsysprof_public_headers = [
'sysprof-source.h',
'sysprof-symbol-dirs.h',
'sysprof-symbol-resolver.h',
'sysprof-symbols-source.h',
'sysprof-tracefd-source.h',
'sysprof.h',
]

View File

@ -0,0 +1,92 @@
/* sysprof-symbols-source.c
*
* Copyright 2019 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sysprof-symbols-source"
#include "config.h"
#include "sysprof-symbols-source.h"
struct _SysprofSymbolsSource
{
GObject parent_instance;
SysprofCaptureWriter *writer;
};
static void source_iface_init (SysprofSourceInterface *iface);
G_DEFINE_TYPE_WITH_CODE (SysprofSymbolsSource, sysprof_symbols_source, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
static void
sysprof_symbols_source_finalize (GObject *object)
{
SysprofSymbolsSource *self = (SysprofSymbolsSource *)object;
g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
G_OBJECT_CLASS (sysprof_symbols_source_parent_class)->finalize (object);
}
static void
sysprof_symbols_source_class_init (SysprofSymbolsSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = sysprof_symbols_source_finalize;
}
static void
sysprof_symbols_source_init (SysprofSymbolsSource *self)
{
}
static void
sysprof_symbols_source_set_writer (SysprofSource *source,
SysprofCaptureWriter *writer)
{
SysprofSymbolsSource *self = (SysprofSymbolsSource *)source;
g_assert (SYSPROF_IS_SYMBOLS_SOURCE (self));
g_assert (writer != NULL);
g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
self->writer = sysprof_capture_writer_ref (writer);
}
static void
sysprof_symbols_source_supplement (SysprofSource *source,
SysprofCaptureReader *reader)
{
SysprofSymbolsSource *self = (SysprofSymbolsSource *)source;
g_assert (SYSPROF_IS_SYMBOLS_SOURCE (self));
g_assert (reader != NULL);
g_assert (self->writer != NULL);
}
static void
source_iface_init (SysprofSourceInterface *iface)
{
iface->set_writer = sysprof_symbols_source_set_writer;
iface->supplement = sysprof_symbols_source_supplement;
}

View File

@ -0,0 +1,35 @@
/* sysprof-symbols-source.h
*
* Copyright 2019 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include "sysprof-source.h"
G_BEGIN_DECLS
#define SYSPROF_TYPE_SYMBOLS_SOURCE (sysprof_symbols_source_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (SysprofSymbolsSource, sysprof_symbols_source, SYSPROF, SYMBOLS_SOURCE, GObject)
SYSPROF_AVAILABLE_IN_ALL
SysprofSource *sysprof_symbols_source_new (void);
G_END_DECLS

View File

@ -42,6 +42,7 @@ G_BEGIN_DECLS
# include "sysprof-symbol-resolver.h"
# include "sysprof-map-lookaside.h"
# include "sysprof-selection.h"
# include "sysprof-symbols-source.h"
# include "sysprof-tracefd-source.h"
#ifdef __linux__