mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-09 22:50:54 +00:00
libsysprof-analyze: start on symbols API via document
This commit is contained in:
@ -11,6 +11,7 @@ libsysprof_analyze_public_sources = [
|
|||||||
'sysprof-document-process.c',
|
'sysprof-document-process.c',
|
||||||
'sysprof-document-process-list.c',
|
'sysprof-document-process-list.c',
|
||||||
'sysprof-document-sample.c',
|
'sysprof-document-sample.c',
|
||||||
|
'sysprof-document-symbols.c',
|
||||||
'sysprof-document-traceable.c',
|
'sysprof-document-traceable.c',
|
||||||
'sysprof-multi-symbolizer.c',
|
'sysprof-multi-symbolizer.c',
|
||||||
'sysprof-symbol.c',
|
'sysprof-symbol.c',
|
||||||
@ -31,6 +32,7 @@ libsysprof_analyze_public_headers = [
|
|||||||
'sysprof-document-process.h',
|
'sysprof-document-process.h',
|
||||||
'sysprof-document-process-list.h',
|
'sysprof-document-process-list.h',
|
||||||
'sysprof-document-sample.h',
|
'sysprof-document-sample.h',
|
||||||
|
'sysprof-document-symbols.h',
|
||||||
'sysprof-document-traceable.h',
|
'sysprof-document-traceable.h',
|
||||||
'sysprof-multi-symbolizer.h',
|
'sysprof-multi-symbolizer.h',
|
||||||
'sysprof-symbol.h',
|
'sysprof-symbol.h',
|
||||||
|
|||||||
@ -37,6 +37,7 @@ G_BEGIN_DECLS
|
|||||||
# include "sysprof-document-process.h"
|
# include "sysprof-document-process.h"
|
||||||
# include "sysprof-document-process-list.h"
|
# include "sysprof-document-process-list.h"
|
||||||
# include "sysprof-document-sample.h"
|
# include "sysprof-document-sample.h"
|
||||||
|
# include "sysprof-document-symbols.h"
|
||||||
# include "sysprof-document-traceable.h"
|
# include "sysprof-document-traceable.h"
|
||||||
# include "sysprof-multi-symbolizer.h"
|
# include "sysprof-multi-symbolizer.h"
|
||||||
# include "sysprof-symbol.h"
|
# include "sysprof-symbol.h"
|
||||||
|
|||||||
31
src/libsysprof-analyze/sysprof-document-symbols-private.h
Normal file
31
src/libsysprof-analyze/sysprof-document-symbols-private.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/* sysprof-document-symbols-private.h
|
||||||
|
*
|
||||||
|
* Copyright 2023 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-document.h"
|
||||||
|
#include "sysprof-document-symbols.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
SysprofDocumentSymbols *_sysprof_document_symbols_new (SysprofDocument *document,
|
||||||
|
SysprofSymbolizer *symbolizer);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
70
src/libsysprof-analyze/sysprof-document-symbols.c
Normal file
70
src/libsysprof-analyze/sysprof-document-symbols.c
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/* sysprof-document-symbols.c
|
||||||
|
*
|
||||||
|
* Copyright 2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "sysprof-document-symbols-private.h"
|
||||||
|
|
||||||
|
struct _SysprofDocumentSymbols
|
||||||
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
SysprofSymbolizer *symbolizer;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_FINAL_TYPE (SysprofDocumentSymbols, sysprof_document_symbols, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_document_symbols_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
SysprofDocumentSymbols *self = (SysprofDocumentSymbols *)object;
|
||||||
|
|
||||||
|
g_clear_object (&self->symbolizer);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (sysprof_document_symbols_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_document_symbols_class_init (SysprofDocumentSymbolsClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->finalize = sysprof_document_symbols_finalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_document_symbols_init (SysprofDocumentSymbols *self)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SysprofDocumentSymbols *
|
||||||
|
_sysprof_document_symbols_new (SysprofDocument *document,
|
||||||
|
SysprofSymbolizer *symbolizer)
|
||||||
|
{
|
||||||
|
SysprofDocumentSymbols *self;
|
||||||
|
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_DOCUMENT (document), NULL);
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_SYMBOLIZER (symbolizer), NULL);
|
||||||
|
|
||||||
|
self = g_object_new (SYSPROF_TYPE_DOCUMENT_SYMBOLS, NULL);
|
||||||
|
|
||||||
|
/* TODO: async generation of symbols */
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
43
src/libsysprof-analyze/sysprof-document-symbols.h
Normal file
43
src/libsysprof-analyze/sysprof-document-symbols.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* sysprof-document-symbols.h
|
||||||
|
*
|
||||||
|
* Copyright 2023 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 <glib-object.h>
|
||||||
|
|
||||||
|
#include <sysprof-capture.h>
|
||||||
|
|
||||||
|
#include "sysprof-symbol.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define SYSPROF_TYPE_DOCUMENT_SYMBOLS (sysprof_document_symbols_get_type())
|
||||||
|
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
G_DECLARE_FINAL_TYPE (SysprofDocumentSymbols, sysprof_document_symbols, SYSPROF, DOCUMENT_SYMBOLS, GObject)
|
||||||
|
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
SysprofSymbol *sysprof_document_symbols_lookup (SysprofDocumentSymbols *symbols,
|
||||||
|
int pid,
|
||||||
|
SysprofAddressContext context,
|
||||||
|
SysprofAddress address);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
@ -22,7 +22,10 @@
|
|||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include "sysprof-version-macros.h"
|
#include <sysprof-capture.h>
|
||||||
|
|
||||||
|
#include "sysprof-document-symbols.h"
|
||||||
|
#include "sysprof-symbolizer.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -32,10 +35,20 @@ SYSPROF_AVAILABLE_IN_ALL
|
|||||||
G_DECLARE_FINAL_TYPE (SysprofDocument, sysprof_document, SYSPROF, DOCUMENT, GObject)
|
G_DECLARE_FINAL_TYPE (SysprofDocument, sysprof_document, SYSPROF, DOCUMENT, GObject)
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
SysprofDocument *sysprof_document_new (const char *filename,
|
SysprofDocument *sysprof_document_new (const char *filename,
|
||||||
GError **error);
|
GError **error);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
SysprofDocument *sysprof_document_new_from_fd (int capture_fd,
|
SysprofDocument *sysprof_document_new_from_fd (int capture_fd,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
void sysprof_document_symbolize_async (SysprofDocument *self,
|
||||||
|
SysprofSymbolizer *symbolizer,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
SysprofDocumentSymbols *sysprof_document_symbolize_finish (SysprofDocument *self,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
Reference in New Issue
Block a user