From f3ac1f58a2b6dae1110fd024cbf4c3f2612f62de Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 8 Nov 2024 15:07:30 -0800 Subject: [PATCH] update patches to sysprof-el10 branch We now have a branch upstream for tracking el10 patches which makes this a lot easier to maintain. This updates to using that branch as a diff upon 47.1. Resolves: RHEL-65743 --- 0001-build-add-47-version-macros.patch | 42 +++ ...o-not-allow-setting-self-as-debug-li.patch | 4 +- ...f-elf-do-not-generate-fallback-names.patch | 4 +- ...=> 0004-sysprof-update-to-AdwSpinner.patch | 4 +- ...-add-SysprofDocumentTask-abstraction.patch | 22 +- ...prof-add-setup-hooks-for-symbolizers.patch | 4 +- ...sprof-hoist-fallback-symbol-creation.patch | 4 +- ...libsysprof-add-debuginfod-symbolizer.patch | 12 +- ...ysprof-ensure-access-to-process-info.patch | 4 +- ...f-fix-building-with-Ddebuginfod-auto.patch | 4 +- ...n-NULL-instance-unless-debuginfod-wo.patch | 4 +- ...d-always-build-debuginfod-symbolizer.patch | 4 +- ...move-unnecessary-address-calculation.patch | 4 +- ...=> 0014-libsysprof-add-muxer-GSource.patch | 4 +- ...upport-for-stack-regs-options-in-att.patch | 4 +- ...port-for-unwinding-without-frame-poi.patch | 6 +- ...ysprofUserSampler-for-live-unwinding.patch | 10 +- ...f-cli-add-support-for-live-unwinding.patch | 4 +- ...19-sysprof-add-UI-for-live-unwinding.patch | 4 +- ...-live-unwinder-disable-test-in-build.patch | 38 --- ...e-unwinder-ifdef-unused-code-off-x86.patch | 49 ++++ ...only-show-user-stack-sampling-on-x86.patch | 58 ++++ ...-for-PERF_REG_EXTENDED_MASK-availabi.patch | 11 +- ...e-unwinder-fix-source-func-prototype.patch | 38 +++ ...inder-handle-large-stack-unwind-size.patch | 28 ++ ...er-wait-for-completion-of-subprocess.patch | 67 +++++ ...user-sampler-implement-await-for-FDs.patch | 16 +- ...prof-provide-unwind-pipe-from-client.patch | 276 ++++++++++++++++++ ...nwinder-error-out-on-capture-failure.patch | 31 ++ 0029-sysprofd-remove-unused-code.patch | 37 +++ ...anel-requirement-to-ease-some-build-.patch | 14 +- ...allow-await-for-FD-with-older-libdex.patch | 168 +++++++++++ ...f-default-stack-capturing-as-enabled.patch | 0 sysprof.spec | 51 ++-- 34 files changed, 898 insertions(+), 132 deletions(-) create mode 100644 0001-build-add-47-version-macros.patch rename 0001-sysprof-update-to-AdwSpinner.patch => 0004-sysprof-update-to-AdwSpinner.patch (94%) rename 0004-sysprof-add-SysprofDocumentTask-abstraction.patch => 0005-sysprof-add-SysprofDocumentTask-abstraction.patch (99%) rename 0005-libsysprof-add-setup-hooks-for-symbolizers.patch => 0006-libsysprof-add-setup-hooks-for-symbolizers.patch (97%) rename 0006-libsysprof-hoist-fallback-symbol-creation.patch => 0007-libsysprof-hoist-fallback-symbol-creation.patch (97%) rename 0007-libsysprof-add-debuginfod-symbolizer.patch => 0008-libsysprof-add-debuginfod-symbolizer.patch (98%) rename 0008-libsysprof-ensure-access-to-process-info.patch => 0009-libsysprof-ensure-access-to-process-info.patch (85%) rename 0009-libsysprof-fix-building-with-Ddebuginfod-auto.patch => 0010-libsysprof-fix-building-with-Ddebuginfod-auto.patch (83%) rename 0010-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch => 0011-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch (97%) rename 0011-build-always-build-debuginfod-symbolizer.patch => 0012-build-always-build-debuginfod-symbolizer.patch (93%) rename 0012-libsysprof-remove-unnecessary-address-calculation.patch => 0013-libsysprof-remove-unnecessary-address-calculation.patch (93%) rename 0013-libsysprof-add-muxer-GSource.patch => 0014-libsysprof-add-muxer-GSource.patch (98%) rename 0014-libsysprof-add-support-for-stack-regs-options-in-att.patch => 0015-libsysprof-add-support-for-stack-regs-options-in-att.patch (98%) rename 0015-sysprofd-add-support-for-unwinding-without-frame-poi.patch => 0016-sysprofd-add-support-for-unwinding-without-frame-poi.patch (99%) rename 0016-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch => 0017-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch (99%) rename 0017-sysprof-cli-add-support-for-live-unwinding.patch => 0018-sysprof-cli-add-support-for-live-unwinding.patch (94%) rename 0018-sysprof-add-UI-for-live-unwinding.patch => 0019-sysprof-add-UI-for-live-unwinding.patch (99%) delete mode 100644 0020-live-unwinder-disable-test-in-build.patch create mode 100644 0020-sysprof-live-unwinder-ifdef-unused-code-off-x86.patch create mode 100644 0021-sysprof-only-show-user-stack-sampling-on-x86.patch rename 0023-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch => 0022-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch (79%) create mode 100644 0023-sysprof-live-unwinder-fix-source-func-prototype.patch create mode 100644 0024-sysprof-live-unwinder-handle-large-stack-unwind-size.patch create mode 100644 0025-unwinder-wait-for-completion-of-subprocess.patch rename 0021-sysprof-user-sampler-implement-await-for-FDs.patch => 0026-sysprof-user-sampler-implement-await-for-FDs.patch (93%) create mode 100644 0027-libsysprof-provide-unwind-pipe-from-client.patch create mode 100644 0028-sysprof-live-unwinder-error-out-on-capture-failure.patch create mode 100644 0029-sysprofd-remove-unused-code.patch rename 0022-sysprof-lower-libpanel-requirement.patch => 0030-build-lower-libpanel-requirement-to-ease-some-build-.patch (65%) create mode 100644 0031-build-allow-await-for-FD-with-older-libdex.patch rename 0019-sysprof-default-stack-capturing-as-enabled.patch => 0032-sysprof-default-stack-capturing-as-enabled.patch (100%) diff --git a/0001-build-add-47-version-macros.patch b/0001-build-add-47-version-macros.patch new file mode 100644 index 0000000..850c61b --- /dev/null +++ b/0001-build-add-47-version-macros.patch @@ -0,0 +1,42 @@ +From 86cd5222dc05e81305ffb22a49cb453c2f90e055 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 16:11:47 -0800 +Subject: [PATCH 01/31] build: add 47 version macros + +--- + src/libsysprof-capture/sysprof-version-macros.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/libsysprof-capture/sysprof-version-macros.h b/src/libsysprof-capture/sysprof-version-macros.h +index 67dac287..d11b6bc9 100644 +--- a/src/libsysprof-capture/sysprof-version-macros.h ++++ b/src/libsysprof-capture/sysprof-version-macros.h +@@ -91,6 +91,7 @@ + #define SYSPROF_VERSION_3_38 (SYSPROF_ENCODE_VERSION (3, 38, 0)) + #define SYSPROF_VERSION_3_40 (SYSPROF_ENCODE_VERSION (3, 40, 0)) + #define SYSPROF_VERSION_3_46 (SYSPROF_ENCODE_VERSION (3, 46, 0)) ++#define SYSPROF_VERSION_47 (SYSPROF_ENCODE_VERSION (47, 0, 0)) + + #if (SYSPROF_MINOR_VERSION == 99) + # define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0, 0)) +@@ -232,3 +233,17 @@ + #else + # define SYSPROF_AVAILABLE_IN_3_46 _SYSPROF_EXTERN + #endif ++ ++#if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_47 ++# define SYSPROF_DEPRECATED_IN_47 SYSPROF_DEPRECATED ++# define SYSPROF_DEPRECATED_IN_47_FOR(f) SYSPROF_DEPRECATED_FOR(f) ++#else ++# define SYSPROF_DEPRECATED_IN_47 _SYSPROF_EXTERN ++# define SYSPROF_DEPRECATED_IN_47_FOR(f) _SYSPROF_EXTERN ++#endif ++ ++#if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_47 ++# define SYSPROF_AVAILABLE_IN_47 SYSPROF_UNAVAILABLE(47, 0) ++#else ++# define SYSPROF_AVAILABLE_IN_47 _SYSPROF_EXTERN ++#endif +-- +2.45.2 + diff --git a/0002-libsysprof-elf-do-not-allow-setting-self-as-debug-li.patch b/0002-libsysprof-elf-do-not-allow-setting-self-as-debug-li.patch index b4c3486..3479cf0 100644 --- a/0002-libsysprof-elf-do-not-allow-setting-self-as-debug-li.patch +++ b/0002-libsysprof-elf-do-not-allow-setting-self-as-debug-li.patch @@ -1,7 +1,7 @@ -From 56dfb1d6422cb0b687751b79528e56b6f9e3dfe6 Mon Sep 17 00:00:00 2001 +From c7910ee7b9f8d2b15f0b05f33e2280e3861ba9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 9 Oct 2024 15:29:59 +0200 -Subject: [PATCH 02/18] libsysprof: elf: do not allow setting self as debug +Subject: [PATCH 02/31] libsysprof: elf: do not allow setting self as debug link That will cause infinite recursion in `sysprof_elf_get_symbol_at_address_internal()`. diff --git a/0003-libsysprof-elf-do-not-generate-fallback-names.patch b/0003-libsysprof-elf-do-not-generate-fallback-names.patch index 1acd884..55b68ec 100644 --- a/0003-libsysprof-elf-do-not-generate-fallback-names.patch +++ b/0003-libsysprof-elf-do-not-generate-fallback-names.patch @@ -1,7 +1,7 @@ -From 5792f34efabc3d2c2a5292d3b30a597d5c53374b Mon Sep 17 00:00:00 2001 +From 8a8b5b25ff8cb9119fc781ea686826723c93d2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 9 Oct 2024 15:28:14 +0200 -Subject: [PATCH 03/18] libsysprof: elf: do not generate fallback names +Subject: [PATCH 03/31] libsysprof: elf: do not generate fallback names Fallback names are only used in `SysprofElfSymbolizer` at the moment, but it also has code to generate fallback symbols. diff --git a/0001-sysprof-update-to-AdwSpinner.patch b/0004-sysprof-update-to-AdwSpinner.patch similarity index 94% rename from 0001-sysprof-update-to-AdwSpinner.patch rename to 0004-sysprof-update-to-AdwSpinner.patch index f61a0c6..5620ac3 100644 --- a/0001-sysprof-update-to-AdwSpinner.patch +++ b/0004-sysprof-update-to-AdwSpinner.patch @@ -1,7 +1,7 @@ -From 1804382418ba2b98d97ca47cbdc2a79cca7061e6 Mon Sep 17 00:00:00 2001 +From 5fc61b27c750788e23f41ed2e87c99cca0dedd9c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 9 Oct 2024 16:39:13 -0700 -Subject: [PATCH 01/18] sysprof: update to AdwSpinner +Subject: [PATCH 04/31] sysprof: update to AdwSpinner --- src/sysprof/meson.build | 2 +- diff --git a/0004-sysprof-add-SysprofDocumentTask-abstraction.patch b/0005-sysprof-add-SysprofDocumentTask-abstraction.patch similarity index 99% rename from 0004-sysprof-add-SysprofDocumentTask-abstraction.patch rename to 0005-sysprof-add-SysprofDocumentTask-abstraction.patch index 7094106..be4b37e 100644 --- a/0004-sysprof-add-SysprofDocumentTask-abstraction.patch +++ b/0005-sysprof-add-SysprofDocumentTask-abstraction.patch @@ -1,7 +1,7 @@ -From f1ce6229182005afe07896381a884eacda229b5c Mon Sep 17 00:00:00 2001 +From 9e249f245e783ac4b05a04ed368ce173f732d371 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 10 Oct 2024 17:02:06 -0700 -Subject: [PATCH 04/18] sysprof: add SysprofDocumentTask abstraction +Subject: [PATCH 05/31] sysprof: add SysprofDocumentTask abstraction This provides a task abstraction to SysprofDocumentLoader so that we can elevate information about tasks to the user interface. It also moves the @@ -314,14 +314,14 @@ index 6622f325..3cd408c4 100644 + return g_object_ref (G_LIST_MODEL (self->tasks)); +} diff --git a/src/libsysprof/sysprof-document-loader.h b/src/libsysprof/sysprof-document-loader.h -index 289dae30..1a1ea7da 100644 +index 289dae30..b157b046 100644 --- a/src/libsysprof/sysprof-document-loader.h +++ b/src/libsysprof/sysprof-document-loader.h @@ -48,6 +48,8 @@ SYSPROF_AVAILABLE_IN_ALL double sysprof_document_loader_get_fraction (SysprofDocumentLoader *self); SYSPROF_AVAILABLE_IN_ALL const char *sysprof_document_loader_get_message (SysprofDocumentLoader *self); -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +GListModel *sysprof_document_loader_list_tasks (SysprofDocumentLoader *self); SYSPROF_AVAILABLE_IN_ALL SysprofDocument *sysprof_document_loader_load (SysprofDocumentLoader *self, @@ -720,7 +720,7 @@ index 00000000..a8bfb30a +} diff --git a/src/libsysprof/sysprof-document-task.h b/src/libsysprof/sysprof-document-task.h new file mode 100644 -index 00000000..1f0be928 +index 00000000..3a2a6c5d --- /dev/null +++ b/src/libsysprof/sysprof-document-task.h @@ -0,0 +1,46 @@ @@ -755,18 +755,18 @@ index 00000000..1f0be928 + +#define SYSPROF_TYPE_DOCUMENT_TASK (sysprof_document_task_get_type()) + -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +G_DECLARE_DERIVABLE_TYPE (SysprofDocumentTask, sysprof_document_task, SYSPROF, DOCUMENT_TASK, GObject) + -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +double sysprof_document_task_get_progress (SysprofDocumentTask *self); -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +char *sysprof_document_task_dup_message (SysprofDocumentTask *self); -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +char *sysprof_document_task_dup_title (SysprofDocumentTask *self); -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +gboolean sysprof_document_task_is_cancelled (SysprofDocumentTask *self); -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +void sysprof_document_task_cancel (SysprofDocumentTask *self); + +G_END_DECLS diff --git a/0005-libsysprof-add-setup-hooks-for-symbolizers.patch b/0006-libsysprof-add-setup-hooks-for-symbolizers.patch similarity index 97% rename from 0005-libsysprof-add-setup-hooks-for-symbolizers.patch rename to 0006-libsysprof-add-setup-hooks-for-symbolizers.patch index dbe33fc..825fc1c 100644 --- a/0005-libsysprof-add-setup-hooks-for-symbolizers.patch +++ b/0006-libsysprof-add-setup-hooks-for-symbolizers.patch @@ -1,7 +1,7 @@ -From a0ede5e2b3decc0002f452f0d44bd1a3e7e23870 Mon Sep 17 00:00:00 2001 +From 3633d7b645c4db819cf2263ae32fa63b413c5eb9 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 10 Oct 2024 17:03:30 -0700 -Subject: [PATCH 05/18] libsysprof: add setup hooks for symbolizers +Subject: [PATCH 06/31] libsysprof: add setup hooks for symbolizers This gives the symbolizer access to the loader so we can propagate tasks back to it. diff --git a/0006-libsysprof-hoist-fallback-symbol-creation.patch b/0007-libsysprof-hoist-fallback-symbol-creation.patch similarity index 97% rename from 0006-libsysprof-hoist-fallback-symbol-creation.patch rename to 0007-libsysprof-hoist-fallback-symbol-creation.patch index 7d70993..c70cb3c 100644 --- a/0006-libsysprof-hoist-fallback-symbol-creation.patch +++ b/0007-libsysprof-hoist-fallback-symbol-creation.patch @@ -1,7 +1,7 @@ -From 045589a30f5436d5a2887136952e8e0a28e8f2dc Mon Sep 17 00:00:00 2001 +From 271b9abbbca3b334f95cb70141fac9ad2452f3f5 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 10 Oct 2024 17:04:19 -0700 -Subject: [PATCH 06/18] libsysprof: hoist fallback symbol creation +Subject: [PATCH 07/31] libsysprof: hoist fallback symbol creation This makes sure that we get that even when not using the Elf symbolizer but also means we can fallback through the Elf symbolizer into the diff --git a/0007-libsysprof-add-debuginfod-symbolizer.patch b/0008-libsysprof-add-debuginfod-symbolizer.patch similarity index 98% rename from 0007-libsysprof-add-debuginfod-symbolizer.patch rename to 0008-libsysprof-add-debuginfod-symbolizer.patch index a46650e..e3c6d81 100644 --- a/0007-libsysprof-add-debuginfod-symbolizer.patch +++ b/0008-libsysprof-add-debuginfod-symbolizer.patch @@ -1,7 +1,7 @@ -From e2de54ccf2bf02dc869e83645a980db158509ae2 Mon Sep 17 00:00:00 2001 +From 18f01748814e558f3b2754ef9c541e8e4b2b3fb0 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 10 Oct 2024 17:07:21 -0700 -Subject: [PATCH 07/18] libsysprof: add debuginfod symbolizer +Subject: [PATCH 08/31] libsysprof: add debuginfod symbolizer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -39,7 +39,7 @@ index d2f7589a..48b3c2c2 100644 #mesondefine HAVE_POLKIT diff --git a/meson.build b/meson.build -index dda0ca4e..81e97072 100644 +index 96c1d093..bac8eae6 100644 --- a/meson.build +++ b/meson.build @@ -63,6 +63,7 @@ gio_unix_dep = dependency('gio-unix-2.0', version: glib_req_version, @@ -331,7 +331,7 @@ index 00000000..8dd60d19 +} diff --git a/src/libsysprof/sysprof-debuginfod-symbolizer.h b/src/libsysprof/sysprof-debuginfod-symbolizer.h new file mode 100644 -index 00000000..32dd347e +index 00000000..3a01e566 --- /dev/null +++ b/src/libsysprof/sysprof-debuginfod-symbolizer.h @@ -0,0 +1,42 @@ @@ -369,9 +369,9 @@ index 00000000..32dd347e +typedef struct _SysprofDebuginfodSymbolizer SysprofDebuginfodSymbolizer; +typedef struct _SysprofDebuginfodSymbolizerClass SysprofDebuginfodSymbolizerClass; + -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +GType sysprof_debuginfod_symbolizer_get_type (void) G_GNUC_CONST; -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +SysprofSymbolizer *sysprof_debuginfod_symbolizer_new (GError **error); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofDebuginfodSymbolizer, g_object_unref) diff --git a/0008-libsysprof-ensure-access-to-process-info.patch b/0009-libsysprof-ensure-access-to-process-info.patch similarity index 85% rename from 0008-libsysprof-ensure-access-to-process-info.patch rename to 0009-libsysprof-ensure-access-to-process-info.patch index e593d7c..4e1d0af 100644 --- a/0008-libsysprof-ensure-access-to-process-info.patch +++ b/0009-libsysprof-ensure-access-to-process-info.patch @@ -1,7 +1,7 @@ -From 27e5392cbf4ce792a26acc0945d36a243d9826cf Mon Sep 17 00:00:00 2001 +From 9895b74a43dcbb41704572d2304d03d4d24397f2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 11 Oct 2024 11:08:52 -0700 -Subject: [PATCH 08/18] libsysprof: ensure access to process info +Subject: [PATCH 09/31] libsysprof: ensure access to process info --- src/libsysprof/sysprof-document-symbols.c | 3 +++ diff --git a/0009-libsysprof-fix-building-with-Ddebuginfod-auto.patch b/0010-libsysprof-fix-building-with-Ddebuginfod-auto.patch similarity index 83% rename from 0009-libsysprof-fix-building-with-Ddebuginfod-auto.patch rename to 0010-libsysprof-fix-building-with-Ddebuginfod-auto.patch index 9675f2d..96b21e8 100644 --- a/0009-libsysprof-fix-building-with-Ddebuginfod-auto.patch +++ b/0010-libsysprof-fix-building-with-Ddebuginfod-auto.patch @@ -1,7 +1,7 @@ -From 970acbbcf5a25983b593ef781885c81f8d55cee2 Mon Sep 17 00:00:00 2001 +From 2c89e348dd469913cf80a1dc4f003aaf5ae7c2ba Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 11 Oct 2024 11:26:13 -0700 -Subject: [PATCH 09/18] libsysprof: fix building with -Ddebuginfod=auto +Subject: [PATCH 10/31] libsysprof: fix building with -Ddebuginfod=auto --- src/libsysprof/meson.build | 2 +- diff --git a/0010-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch b/0011-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch similarity index 97% rename from 0010-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch rename to 0011-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch index 471e605..71e264c 100644 --- a/0010-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch +++ b/0011-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch @@ -1,7 +1,7 @@ -From f9f78bfbd727b0b95dff4fad5325c72731e0e970 Mon Sep 17 00:00:00 2001 +From c81b5ae5e690eba77498c3a79db168467641d286 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 11 Oct 2024 11:45:41 -0700 -Subject: [PATCH 10/18] libsysprof: return NULL instance unless debuginfod +Subject: [PATCH 11/31] libsysprof: return NULL instance unless debuginfod works If we are configured with support for debuginfod and it fails to initialize diff --git a/0011-build-always-build-debuginfod-symbolizer.patch b/0012-build-always-build-debuginfod-symbolizer.patch similarity index 93% rename from 0011-build-always-build-debuginfod-symbolizer.patch rename to 0012-build-always-build-debuginfod-symbolizer.patch index d1a6800..ee0b628 100644 --- a/0011-build-always-build-debuginfod-symbolizer.patch +++ b/0012-build-always-build-debuginfod-symbolizer.patch @@ -1,7 +1,7 @@ -From 7d2fccd26931a2ffb5006511a6ecaf529016d7ae Mon Sep 17 00:00:00 2001 +From e15c1147f1543af5900f1caa8c1adf41a52a8a68 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 11 Oct 2024 11:46:26 -0700 -Subject: [PATCH 11/18] build: always build debuginfod symbolizer +Subject: [PATCH 12/31] build: always build debuginfod symbolizer Even if it is disabled, we want the GType enabled and part of our ABI. We will return NULL if one is created and debuginfod is not supported or if diff --git a/0012-libsysprof-remove-unnecessary-address-calculation.patch b/0013-libsysprof-remove-unnecessary-address-calculation.patch similarity index 93% rename from 0012-libsysprof-remove-unnecessary-address-calculation.patch rename to 0013-libsysprof-remove-unnecessary-address-calculation.patch index 3355b2d..b529160 100644 --- a/0012-libsysprof-remove-unnecessary-address-calculation.patch +++ b/0013-libsysprof-remove-unnecessary-address-calculation.patch @@ -1,7 +1,7 @@ -From d19dd1b167de2c49f33c86908b7715790481a3de Mon Sep 17 00:00:00 2001 +From 2f9eb12a3348ae41d51bbeb56fd293c5204b7851 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 23 Oct 2024 11:54:33 -0700 -Subject: [PATCH 12/18] libsysprof: remove unnecessary address calculation +Subject: [PATCH 13/31] libsysprof: remove unnecessary address calculation We are only fallback symbols here, which is 1 address-wide. --- diff --git a/0013-libsysprof-add-muxer-GSource.patch b/0014-libsysprof-add-muxer-GSource.patch similarity index 98% rename from 0013-libsysprof-add-muxer-GSource.patch rename to 0014-libsysprof-add-muxer-GSource.patch index bfd0af7..298bc31 100644 --- a/0013-libsysprof-add-muxer-GSource.patch +++ b/0014-libsysprof-add-muxer-GSource.patch @@ -1,7 +1,7 @@ -From 37b1710bcb04bcee2f9c05293ac535c514cd392b Mon Sep 17 00:00:00 2001 +From 917b05544e46282ee3d77dcd4ab050df5f80a1d3 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 25 Oct 2024 10:49:15 -0700 -Subject: [PATCH 13/18] libsysprof: add muxer GSource +Subject: [PATCH 14/31] libsysprof: add muxer GSource This allows copying events from a capture stream transparently into the destination. No processing of the stream is performed, but that may change diff --git a/0014-libsysprof-add-support-for-stack-regs-options-in-att.patch b/0015-libsysprof-add-support-for-stack-regs-options-in-att.patch similarity index 98% rename from 0014-libsysprof-add-support-for-stack-regs-options-in-att.patch rename to 0015-libsysprof-add-support-for-stack-regs-options-in-att.patch index b36c101..260985e 100644 --- a/0014-libsysprof-add-support-for-stack-regs-options-in-att.patch +++ b/0015-libsysprof-add-support-for-stack-regs-options-in-att.patch @@ -1,7 +1,7 @@ -From 38646818c06b45417b693695819d05198fb8e53b Mon Sep 17 00:00:00 2001 +From 4583026b751c3d00294ecec6ed1be11dcaf17623 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 3 Nov 2024 10:39:23 -0800 -Subject: [PATCH 14/18] libsysprof: add support for stack/regs options in attr +Subject: [PATCH 15/31] libsysprof: add support for stack/regs options in attr This requires a coordinating sysprofd that knows how to handle reading the new attributes. Setting these fields will allow snapshotting the contents diff --git a/0015-sysprofd-add-support-for-unwinding-without-frame-poi.patch b/0016-sysprofd-add-support-for-unwinding-without-frame-poi.patch similarity index 99% rename from 0015-sysprofd-add-support-for-unwinding-without-frame-poi.patch rename to 0016-sysprofd-add-support-for-unwinding-without-frame-poi.patch index 78942dd..e8c8178 100644 --- a/0015-sysprofd-add-support-for-unwinding-without-frame-poi.patch +++ b/0016-sysprofd-add-support-for-unwinding-without-frame-poi.patch @@ -1,7 +1,7 @@ -From 565ff01f20c66e35c2977a55519bd5e799a39eb3 Mon Sep 17 00:00:00 2001 +From 41248249b257bcb017465e3f7c70dcb19dbd121d Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 3 Nov 2024 10:41:44 -0800 -Subject: [PATCH 15/18] sysprofd: add support for unwinding without frame +Subject: [PATCH 16/31] sysprofd: add support for unwinding without frame pointers This provides a new sysprof-live-unwinder subprocess that runs as root to @@ -50,7 +50,7 @@ of debuginfod to locate the appropriate symbols. create mode 100644 src/sysprofd/org.gnome.Sysprof3.Unwinder.xml diff --git a/meson.build b/meson.build -index 81e97072..9c37ebc4 100644 +index bac8eae6..16d64e8a 100644 --- a/meson.build +++ b/meson.build @@ -39,12 +39,13 @@ need_glib = (need_gtk or diff --git a/0016-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch b/0017-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch similarity index 99% rename from 0016-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch rename to 0017-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch index bd91672..058bf0a 100644 --- a/0016-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch +++ b/0017-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch @@ -1,7 +1,7 @@ -From ef191d3f52ad904a9af8908ff5c2a1e44dfd27b0 Mon Sep 17 00:00:00 2001 +From a58aa3b33173e5fab8ec81b6b2961e2113ea716b Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 3 Nov 2024 10:53:29 -0800 -Subject: [PATCH 16/18] libsysprof: add SysprofUserSampler for live unwinding +Subject: [PATCH 17/31] libsysprof: add SysprofUserSampler for live unwinding This instrument triggers the live unwinder in sysprofd to capture a pre-configured amount of stack contents and CPU registers. You can use @@ -630,7 +630,7 @@ index 00000000..0e3afeae +} diff --git a/src/libsysprof/sysprof-user-sampler.h b/src/libsysprof/sysprof-user-sampler.h new file mode 100644 -index 00000000..2d9e56b5 +index 00000000..d39e6095 --- /dev/null +++ b/src/libsysprof/sysprof-user-sampler.h @@ -0,0 +1,43 @@ @@ -669,9 +669,9 @@ index 00000000..2d9e56b5 +typedef struct _SysprofUserSampler SysprofUserSampler; +typedef struct _SysprofUserSamplerClass SysprofUserSamplerClass; + -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +GType sysprof_user_sampler_get_type (void) G_GNUC_CONST; -+SYSPROF_AVAILABLE_IN_ALL ++SYSPROF_AVAILABLE_IN_47 +SysprofInstrument *sysprof_user_sampler_new (guint stack_size); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofUserSampler, g_object_unref) diff --git a/0017-sysprof-cli-add-support-for-live-unwinding.patch b/0018-sysprof-cli-add-support-for-live-unwinding.patch similarity index 94% rename from 0017-sysprof-cli-add-support-for-live-unwinding.patch rename to 0018-sysprof-cli-add-support-for-live-unwinding.patch index f731c11..f393f26 100644 --- a/0017-sysprof-cli-add-support-for-live-unwinding.patch +++ b/0018-sysprof-cli-add-support-for-live-unwinding.patch @@ -1,7 +1,7 @@ -From da9f2db255c1f0c63c10993eb62db567265ced6e Mon Sep 17 00:00:00 2001 +From f7118874cfac04b8febf38ee9b073b6d46cc3f08 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 3 Nov 2024 10:54:57 -0800 -Subject: [PATCH 17/18] sysprof-cli: add support for live unwinding +Subject: [PATCH 18/31] sysprof-cli: add support for live unwinding This allows you to specify --stack-size=(multiple_of_page_size) to unwind from captured stack contents. It will use the new SysprofUserSampler to diff --git a/0018-sysprof-add-UI-for-live-unwinding.patch b/0019-sysprof-add-UI-for-live-unwinding.patch similarity index 99% rename from 0018-sysprof-add-UI-for-live-unwinding.patch rename to 0019-sysprof-add-UI-for-live-unwinding.patch index 8447a4f..963efa2 100644 --- a/0018-sysprof-add-UI-for-live-unwinding.patch +++ b/0019-sysprof-add-UI-for-live-unwinding.patch @@ -1,7 +1,7 @@ -From 927b13bb407105517783ab1d03c025fecf1d59d9 Mon Sep 17 00:00:00 2001 +From f02e19820e5a3b223f2b563946daa80693c98ca2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 3 Nov 2024 10:57:58 -0800 -Subject: [PATCH 18/18] sysprof: add UI for live unwinding +Subject: [PATCH 19/31] sysprof: add UI for live unwinding This adds UI to specify the amount of stack contents to copy along with the CPU registers so that you may unwind in user-space. diff --git a/0020-live-unwinder-disable-test-in-build.patch b/0020-live-unwinder-disable-test-in-build.patch deleted file mode 100644 index 05da7f9..0000000 --- a/0020-live-unwinder-disable-test-in-build.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 44c780aed1d688695c3f15c757e4e9f14cb4214a Mon Sep 17 00:00:00 2001 -From: Christian Hergert -Date: Wed, 6 Nov 2024 13:33:34 -0800 -Subject: [PATCH] live-unwinder: disable test in build - -It requires newer libdex features we don't need so best to avoid back -porting those too. ---- - meson.build | 2 +- - src/sysprof-live-unwinder/meson.build | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index 9c37ebc4..462782d9 100644 ---- a/meson.build -+++ b/meson.build -@@ -45,7 +45,7 @@ need_libsysprof = (need_gtk or - get_option('tools') or - get_option('tests')) - --dex_req = '0.9' -+dex_req = '0.8' - glib_req = '2.76.0' - gtk_req = '4.15' - polkit_req = '0.105' -diff --git a/src/sysprof-live-unwinder/meson.build b/src/sysprof-live-unwinder/meson.build -index 8cef7106..af797490 100644 ---- a/src/sysprof-live-unwinder/meson.build -+++ b/src/sysprof-live-unwinder/meson.build -@@ -16,4 +16,4 @@ sysprof_live_unwinder = executable('sysprof-live-unwinder', sysprof_live_unwinde - install_dir: pkglibexecdir, - ) - --subdir('tests') -+# subdir('tests') --- -2.45.2 - diff --git a/0020-sysprof-live-unwinder-ifdef-unused-code-off-x86.patch b/0020-sysprof-live-unwinder-ifdef-unused-code-off-x86.patch new file mode 100644 index 0000000..c7184b9 --- /dev/null +++ b/0020-sysprof-live-unwinder-ifdef-unused-code-off-x86.patch @@ -0,0 +1,49 @@ +From 51c7529c515c2e5c4362676e44f2679ce8cc66db Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Mon, 4 Nov 2024 14:21:15 -0800 +Subject: [PATCH 20/31] sysprof-live-unwinder: ifdef unused code off x86 + +Fixes a compiler warning about unused functions. +--- + src/sysprof-live-unwinder/sysprof-live-process.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/sysprof-live-unwinder/sysprof-live-process.c b/src/sysprof-live-unwinder/sysprof-live-process.c +index 7932048b..90fd2633 100644 +--- a/src/sysprof-live-unwinder/sysprof-live-process.c ++++ b/src/sysprof-live-unwinder/sysprof-live-process.c +@@ -80,6 +80,7 @@ typedef struct _SysprofUnwinder + + static SysprofUnwinder *current_unwinder; + ++#if defined(__x86_64__) || defined(__i386__) + static inline GPid + sysprof_unwinder_next_thread (Dwfl *dwfl, + void *user_data, +@@ -230,6 +231,7 @@ sysprof_unwinder_frame_cb (Dwfl_Frame *frame, + + return DWARF_CB_OK; + } ++#endif + + static inline guint + sysprof_unwind (SysprofLiveProcess *self, +@@ -406,6 +408,7 @@ sysprof_live_process_is_active (SysprofLiveProcess *self) + return self->fd > -1; + } + ++#if defined(__x86_64__) || defined(__i386__) + static Dwfl * + sysprof_live_process_get_dwfl (SysprofLiveProcess *self) + { +@@ -440,6 +443,7 @@ sysprof_live_process_get_dwfl (SysprofLiveProcess *self) + + return self->dwfl; + } ++#endif + + guint + sysprof_live_process_unwind (SysprofLiveProcess *self, +-- +2.45.2 + diff --git a/0021-sysprof-only-show-user-stack-sampling-on-x86.patch b/0021-sysprof-only-show-user-stack-sampling-on-x86.patch new file mode 100644 index 0000000..b5553e5 --- /dev/null +++ b/0021-sysprof-only-show-user-stack-sampling-on-x86.patch @@ -0,0 +1,58 @@ +From 7ae54a2e334dead967216f17455026fbcf256186 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Mon, 4 Nov 2024 14:25:07 -0800 +Subject: [PATCH 21/31] sysprof: only show user stack sampling on x86 + +That is the only place it works currently (and is necessary). +--- + src/sysprof/sysprof-greeter.c | 6 ++++++ + src/sysprof/sysprof-greeter.ui | 2 +- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/sysprof/sysprof-greeter.c b/src/sysprof/sysprof-greeter.c +index 52eff370..e0313e81 100644 +--- a/src/sysprof/sysprof-greeter.c ++++ b/src/sysprof/sysprof-greeter.c +@@ -58,6 +58,7 @@ struct _SysprofGreeter + GtkButton *record_to_memory; + AdwComboRow *power_combo; + AdwComboRow *sample_user_stack_size; ++ AdwExpanderRow *user_stacks; + SysprofRecordingTemplate *recording_template; + }; + +@@ -516,6 +517,7 @@ sysprof_greeter_class_init (SysprofGreeterClass *klass) + gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, sample_native_stacks); + gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, sample_user_stack_size); + gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, sidebar_list_box); ++ gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, user_stacks); + gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, view_stack); + + gtk_widget_class_bind_template_callback (widget_class, sidebar_row_activated_cb); +@@ -572,6 +574,10 @@ sysprof_greeter_init (SysprofGreeter *self) + /* Set to 16KB */ + adw_combo_row_set_selected (self->sample_user_stack_size, 1); + ++#if !defined(__x86_64__) && !defined(__i386__) ++ gtk_widget_set_visible (GTK_WIDGET (self->user_stacks), FALSE); ++#endif ++ + gtk_widget_grab_focus (GTK_WIDGET (self->record_to_memory)); + } + +diff --git a/src/sysprof/sysprof-greeter.ui b/src/sysprof/sysprof-greeter.ui +index f7ebbc29..92ade34d 100644 +--- a/src/sysprof/sysprof-greeter.ui ++++ b/src/sysprof/sysprof-greeter.ui +@@ -107,7 +107,7 @@ + + + +- ++ + Unwind Stacks in User Space + Copy stack contents and registers for unwinding in user-space + +-- +2.45.2 + diff --git a/0023-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch b/0022-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch similarity index 79% rename from 0023-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch rename to 0022-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch index 975f3be..0c3cc36 100644 --- a/0023-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch +++ b/0022-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch @@ -1,17 +1,18 @@ -From 83d4d630520d6db875951c301e2320bf7c28109f Mon Sep 17 00:00:00 2001 +From be843d84b49f7cd7ce15352ab187e4197cdd887e Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 8 Nov 2024 11:42:04 -0800 -Subject: [PATCH] libsysprof: check for PERF_REG_EXTENDED_MASK availability +Subject: [PATCH 22/31] libsysprof: check for PERF_REG_EXTENDED_MASK + availability --- src/libsysprof/sysprof-user-sampler.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libsysprof/sysprof-user-sampler.c b/src/libsysprof/sysprof-user-sampler.c -index 1ae3ea27..44b4d318 100644 +index 0e3afeae..a1418596 100644 --- a/src/libsysprof/sysprof-user-sampler.c +++ b/src/libsysprof/sysprof-user-sampler.c -@@ -49,7 +49,11 @@ +@@ -48,7 +48,11 @@ #define SYSPROF_ARCH_PREFERRED_REGS DWARF_NEEDED_REGS /* TODO: add other architectures, imitating the linux tools/perf tree */ #else @@ -25,5 +26,5 @@ index 1ae3ea27..44b4d318 100644 #define N_WAKEUP_EVENTS 149 -- -2.46.1 +2.45.2 diff --git a/0023-sysprof-live-unwinder-fix-source-func-prototype.patch b/0023-sysprof-live-unwinder-fix-source-func-prototype.patch new file mode 100644 index 0000000..1464ba7 --- /dev/null +++ b/0023-sysprof-live-unwinder-fix-source-func-prototype.patch @@ -0,0 +1,38 @@ +From ed19a1b29cf6adc628432128bf6162c1446d5a46 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Tue, 12 Nov 2024 14:45:57 -0800 +Subject: [PATCH 23/31] sysprof-live-unwinder: fix source func prototype + +While this looks like a GSource, the implementation type requires that +it actually be a GUnixFDSourceFunc. +--- + src/sysprof-live-unwinder/main.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/sysprof-live-unwinder/main.c b/src/sysprof-live-unwinder/main.c +index 9e2733ae..e14eaf6c 100644 +--- a/src/sysprof-live-unwinder/main.c ++++ b/src/sysprof-live-unwinder/main.c +@@ -642,7 +642,9 @@ bump_to_max_fd_limit (void) + } + + static gboolean +-exit_callback (gpointer user_data) ++exit_callback (int fd, ++ GIOCondition condition, ++ gpointer user_data) + { + g_main_loop_quit (user_data); + return G_SOURCE_REMOVE; +@@ -738,7 +740,7 @@ Examples:\n\ + g_autoptr(GSource) exit_source = g_unix_fd_source_new (event_fd, G_IO_IN); + + g_source_set_callback (exit_source, +- exit_callback, ++ (GSourceFunc)exit_callback, + g_main_loop_ref (main_loop), + (GDestroyNotify) g_main_loop_unref); + g_source_attach (exit_source, NULL); +-- +2.45.2 + diff --git a/0024-sysprof-live-unwinder-handle-large-stack-unwind-size.patch b/0024-sysprof-live-unwinder-handle-large-stack-unwind-size.patch new file mode 100644 index 0000000..3bfe7ff --- /dev/null +++ b/0024-sysprof-live-unwinder-handle-large-stack-unwind-size.patch @@ -0,0 +1,28 @@ +From 4b28282e30ee9ee483d3ed31a27956a5b35d2e95 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 15:29:15 -0800 +Subject: [PATCH 24/31] sysprof-live-unwinder: handle large stack unwind sizes + +--- + src/sysprof-live-unwinder/sysprof-live-unwinder.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/sysprof-live-unwinder/sysprof-live-unwinder.c b/src/sysprof-live-unwinder/sysprof-live-unwinder.c +index c3b954b2..da77b0b0 100644 +--- a/src/sysprof-live-unwinder/sysprof-live-unwinder.c ++++ b/src/sysprof-live-unwinder/sysprof-live-unwinder.c +@@ -377,6 +377,11 @@ sysprof_live_unwinder_process_sampled_with_stack (SysprofLiveUnwinder *s + return; + } + ++ /* We seem to get values > stack_size, which perhaps indicates we can ++ * sometimes discover if we would not have gotten enough stack to unwind. ++ */ ++ stack_dyn_size = MIN (stack_dyn_size, stack_size); ++ + live_pid = sysprof_live_unwinder_find_pid (self, pid, TRUE); + + /* Copy addresses over (which might be kernel, context-switch, etc until +-- +2.45.2 + diff --git a/0025-unwinder-wait-for-completion-of-subprocess.patch b/0025-unwinder-wait-for-completion-of-subprocess.patch new file mode 100644 index 0000000..8523ea2 --- /dev/null +++ b/0025-unwinder-wait-for-completion-of-subprocess.patch @@ -0,0 +1,67 @@ +From 767e26c0aa2379312da5b029f924f765d90edce8 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 15:46:01 -0800 +Subject: [PATCH 25/31] unwinder: wait for completion of subprocess + +--- + src/sysprofd/ipc-unwinder-impl.c | 28 +++++++++++++++++++++++++++- + 1 file changed, 27 insertions(+), 1 deletion(-) + +diff --git a/src/sysprofd/ipc-unwinder-impl.c b/src/sysprofd/ipc-unwinder-impl.c +index 7f218de6..4341516b 100644 +--- a/src/sysprofd/ipc-unwinder-impl.c ++++ b/src/sysprofd/ipc-unwinder-impl.c +@@ -46,6 +46,25 @@ child_setup (gpointer data) + prctl (PR_SET_PDEATHSIG, SIGKILL); + } + ++static void ++ipc_unwinder_impl_wait_cb (GObject *object, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ GSubprocess *subprocess = (GSubprocess *)object; ++ g_autoptr(IpcUnwinderImpl) self = user_data; ++ g_autoptr(GError) error = NULL; ++ ++ g_assert (G_IS_SUBPROCESS (subprocess)); ++ g_assert (G_IS_ASYNC_RESULT (result)); ++ g_assert (IPC_IS_UNWINDER_IMPL (self)); ++ ++ if (!g_subprocess_wait_check_finish (subprocess, result, &error)) ++ g_warning ("wait_check failure: %s", error->message); ++ else ++ g_info ("sysprof-live-unwinder exited"); ++} ++ + static gboolean + ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder, + GDBusMethodInvocation *invocation, +@@ -155,16 +174,23 @@ ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder, + + if (!(subprocess = g_subprocess_launcher_spawnv (launcher, (const char * const *)argv->pdata, &error))) + { ++ g_critical ("Failed to start sysprof-live-unwinder: %s", error->message); + g_dbus_method_invocation_return_gerror (g_steal_pointer (&invocation), error); + return TRUE; + } + ++ g_message ("sysprof-live-unwinder started as process %s", ++ g_subprocess_get_identifier (subprocess)); ++ + ipc_unwinder_complete_unwind (unwinder, + g_steal_pointer (&invocation), + out_fd_list, + g_variant_new_handle (capture_fd_handle)); + +- g_subprocess_wait_async (subprocess, NULL, NULL, NULL); ++ g_subprocess_wait_check_async (subprocess, ++ NULL, ++ ipc_unwinder_impl_wait_cb, ++ g_object_ref (unwinder)); + + return TRUE; + } +-- +2.45.2 + diff --git a/0021-sysprof-user-sampler-implement-await-for-FDs.patch b/0026-sysprof-user-sampler-implement-await-for-FDs.patch similarity index 93% rename from 0021-sysprof-user-sampler-implement-await-for-FDs.patch rename to 0026-sysprof-user-sampler-implement-await-for-FDs.patch index effab50..ceaf768 100644 --- a/0021-sysprof-user-sampler-implement-await-for-FDs.patch +++ b/0026-sysprof-user-sampler-implement-await-for-FDs.patch @@ -1,7 +1,7 @@ -From 781d438e5e3d4189d8a1970707983ccc6897175c Mon Sep 17 00:00:00 2001 +From 12d0c969b83878d69f36255004b0dae6736a6c03 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 6 Nov 2024 15:09:13 -0800 -Subject: [PATCH] sysprof-user-sampler: implement await for FDs +Subject: [PATCH 26/31] sysprof-user-sampler: implement await for FDs This allows us to not need libdex 0.9+ for use by the sampler. --- @@ -144,7 +144,7 @@ index 00000000..5e34f8d9 + +G_DEFINE_BOXED_TYPE (SysprofFD, sysprof_fd, sysprof_fd_dup, sysprof_fd_free) diff --git a/src/libsysprof/sysprof-user-sampler.c b/src/libsysprof/sysprof-user-sampler.c -index 0e3afeae..1ae3ea27 100644 +index a1418596..44b4d318 100644 --- a/src/libsysprof/sysprof-user-sampler.c +++ b/src/libsysprof/sysprof-user-sampler.c @@ -32,6 +32,7 @@ @@ -155,7 +155,7 @@ index 0e3afeae..1ae3ea27 100644 #include "ipc-unwinder.h" -@@ -81,6 +82,30 @@ close_fd (gpointer data) +@@ -85,6 +86,30 @@ close_fd (gpointer data) } } @@ -186,7 +186,7 @@ index 0e3afeae..1ae3ea27 100644 static void sysprof_user_sampler_ioctl (SysprofUserSampler *self, gboolean enable) -@@ -145,7 +170,7 @@ _perf_event_open_cb (GObject *object, +@@ -149,7 +174,7 @@ _perf_event_open_cb (GObject *object, if (-1 == (fd = g_unix_fd_list_get (fd_list, handle, &error))) goto failure; @@ -195,7 +195,7 @@ index 0e3afeae..1ae3ea27 100644 return; } -@@ -230,7 +255,7 @@ try_again: +@@ -234,7 +259,7 @@ try_again: _perf_event_open_cb, dex_ref (promise)); @@ -204,7 +204,7 @@ index 0e3afeae..1ae3ea27 100644 { g_clear_pointer (&options, g_variant_unref); -@@ -270,7 +295,7 @@ call_unwind_cb (GObject *object, +@@ -274,7 +299,7 @@ call_unwind_cb (GObject *object, if (ipc_unwinder_call_unwind_finish (IPC_UNWINDER (object), &out_capture_fd, &out_fd_list, result, &error) && -1 != (capture_fd = g_unix_fd_list_get (out_fd_list, g_variant_get_handle (out_capture_fd), &error))) @@ -213,7 +213,7 @@ index 0e3afeae..1ae3ea27 100644 else dex_promise_reject (promise, error); } -@@ -402,7 +427,7 @@ sysprof_user_sampler_prepare_fiber (gpointer user_data) +@@ -406,7 +431,7 @@ sysprof_user_sampler_prepare_fiber (gpointer user_data) call_unwind_cb, dex_ref (promise)); diff --git a/0027-libsysprof-provide-unwind-pipe-from-client.patch b/0027-libsysprof-provide-unwind-pipe-from-client.patch new file mode 100644 index 0000000..add3b13 --- /dev/null +++ b/0027-libsysprof-provide-unwind-pipe-from-client.patch @@ -0,0 +1,276 @@ +From 6812ec432141fbdf0754e90d1e7a3d5667b14bf0 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 15:40:52 -0800 +Subject: [PATCH 27/31] libsysprof: provide unwind pipe from client + +We don't need a socketpair for this. Additionally, things seem to work +better from the service when the client provides the pipe. Otherwise, when +running as a dbus service I often have issues with things getting closed +out from under us. +--- + src/libsysprof/sysprof-user-sampler.c | 65 ++++++++++++-------- + src/sysprofd/ipc-unwinder-impl.c | 46 +++----------- + src/sysprofd/org.gnome.Sysprof3.Unwinder.xml | 2 +- + 3 files changed, 48 insertions(+), 65 deletions(-) + +diff --git a/src/libsysprof/sysprof-user-sampler.c b/src/libsysprof/sysprof-user-sampler.c +index 44b4d318..6079708e 100644 +--- a/src/libsysprof/sysprof-user-sampler.c ++++ b/src/libsysprof/sysprof-user-sampler.c +@@ -20,6 +20,8 @@ + + #include "config.h" + ++#include ++ + #include + #include + +@@ -62,7 +64,8 @@ struct _SysprofUserSampler + { + SysprofInstrument parent_instance; + GArray *perf_fds; +- int capture_fd; ++ int capture_fd_read; ++ int capture_fd_write; + int event_fd; + guint stack_size; + }; +@@ -289,17 +292,14 @@ call_unwind_cb (GObject *object, + { + g_autoptr(DexPromise) promise = user_data; + g_autoptr(GUnixFDList) out_fd_list = NULL; +- g_autoptr(GVariant) out_capture_fd = NULL; +- g_autofd int capture_fd = -1; + GError *error = NULL; + + g_assert (IPC_IS_UNWINDER (object)); + g_assert (G_IS_ASYNC_RESULT (result)); + g_assert (DEX_IS_PROMISE (promise)); + +- if (ipc_unwinder_call_unwind_finish (IPC_UNWINDER (object), &out_capture_fd, &out_fd_list, result, &error) && +- -1 != (capture_fd = g_unix_fd_list_get (out_fd_list, g_variant_get_handle (out_capture_fd), &error))) +- promise_resolve_fd (promise, g_steal_fd (&capture_fd)); ++ if (ipc_unwinder_call_unwind_finish (IPC_UNWINDER (object), &out_fd_list, result, &error)) ++ dex_promise_resolve_boolean (promise, TRUE); + else + dex_promise_reject (promise, error); + } +@@ -420,31 +420,26 @@ sysprof_user_sampler_prepare_fiber (gpointer user_data) + { + g_autoptr(DexPromise) promise = dex_promise_new (); + int event_fd_handle = g_unix_fd_list_append (fd_list, prepare->sampler->event_fd, NULL); +- g_autofd int fd = -1; ++ int capture_fd_handle = g_unix_fd_list_append (fd_list, prepare->sampler->capture_fd_write, NULL); + + ipc_unwinder_call_unwind (unwinder, + prepare->stack_size, + g_variant_builder_end (&builder), + g_variant_new_handle (event_fd_handle), ++ g_variant_new_handle (capture_fd_handle), + fd_list, + NULL, + call_unwind_cb, + dex_ref (promise)); + +- fd = await_fd (dex_ref (promise), &error); +- +- if (fd == -1) ++ if (!dex_await (dex_ref (promise), &error)) + { + _sysprof_recording_diagnostic (prepare->recording, + "Sampler", +- "Failed to setup user-space unwinder: %s", ++ "Failed to setup thread unwinder: %s", + error->message); + g_clear_error (&error); + } +- else +- { +- prepare->sampler->capture_fd = g_steal_fd (&fd); +- } + } + } + +@@ -506,21 +501,26 @@ sysprof_user_sampler_record_fiber (gpointer user_data) + + writer = _sysprof_recording_writer (record->recording); + +- sysprof_user_sampler_ioctl (record->sampler, TRUE); ++ if (record->sampler->capture_fd_read != -1) ++ { ++ sysprof_user_sampler_ioctl (record->sampler, TRUE); + +- g_debug ("Staring muxer for capture_fd"); +- muxer_source = sysprof_muxer_source_new (g_steal_fd (&record->sampler->capture_fd), writer); +- g_source_set_static_name (muxer_source, "[stack-muxer]"); +- g_source_attach (muxer_source, NULL); ++ g_debug ("Staring muxer for capture_fd %d", record->sampler->capture_fd_read); ++ muxer_source = sysprof_muxer_source_new (g_steal_fd (&record->sampler->capture_fd_read), writer); ++ g_source_set_static_name (muxer_source, "[stack-muxer]"); ++ g_source_attach (muxer_source, NULL); + +- if (!dex_await (dex_ref (record->cancellable), &error)) +- g_debug ("UserSampler shutting down for reason: %s", error->message); ++ if (!dex_await (dex_ref (record->cancellable), &error)) ++ g_debug ("UserSampler shutting down for reason: %s", error->message); + +- write (record->sampler->event_fd, &exiting, sizeof exiting); ++ write (record->sampler->event_fd, &exiting, sizeof exiting); + +- g_source_destroy (muxer_source); ++ g_source_destroy (muxer_source); + +- sysprof_user_sampler_ioctl (record->sampler, FALSE); ++ sysprof_user_sampler_ioctl (record->sampler, FALSE); ++ } ++ else ++ g_warning ("No capture FD available for muxing"); + + return dex_future_new_for_boolean (TRUE); + } +@@ -555,7 +555,8 @@ sysprof_user_sampler_finalize (GObject *object) + + g_clear_pointer (&self->perf_fds, g_array_unref); + +- g_clear_fd (&self->capture_fd, NULL); ++ g_clear_fd (&self->capture_fd_read, NULL); ++ g_clear_fd (&self->capture_fd_write, NULL); + g_clear_fd (&self->event_fd, NULL); + + G_OBJECT_CLASS (sysprof_user_sampler_parent_class)->finalize (object); +@@ -577,9 +578,19 @@ sysprof_user_sampler_class_init (SysprofUserSamplerClass *klass) + static void + sysprof_user_sampler_init (SysprofUserSampler *self) + { +- self->capture_fd = -1; ++ int fds[2]; ++ + self->event_fd = eventfd (0, EFD_CLOEXEC); + ++ self->capture_fd_read = -1; ++ self->capture_fd_write = -1; ++ ++ if (pipe2 (fds, O_CLOEXEC) == 0) ++ { ++ self->capture_fd_read = fds[0]; ++ self->capture_fd_write = fds[1]; ++ } ++ + self->perf_fds = g_array_new (FALSE, FALSE, sizeof (int)); + g_array_set_clear_func (self->perf_fds, close_fd); + } +diff --git a/src/sysprofd/ipc-unwinder-impl.c b/src/sysprofd/ipc-unwinder-impl.c +index 4341516b..e6a0d7ab 100644 +--- a/src/sysprofd/ipc-unwinder-impl.c ++++ b/src/sysprofd/ipc-unwinder-impl.c +@@ -24,6 +24,7 @@ + #include "config.h" + + #include ++#include + + #include + #include +@@ -71,19 +72,16 @@ ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder, + GUnixFDList *fd_list, + guint stack_size, + GVariant *arg_perf_fds, +- GVariant *arg_event_fd) ++ GVariant *arg_event_fd, ++ GVariant *arg_capture_fd) + { + g_autoptr(GSubprocessLauncher) launcher = NULL; + g_autoptr(GSubprocess) subprocess = NULL; +- g_autoptr(GUnixFDList) out_fd_list = NULL; + g_autoptr(GPtrArray) argv = NULL; + g_autoptr(GError) error = NULL; +- g_autofd int our_fd = -1; +- g_autofd int their_fd = -1; ++ g_autofd int capture_fd = -1; + g_autofd int event_fd = -1; + GVariantIter iter; +- int capture_fd_handle; +- int pair[2]; + int next_target_fd = 3; + int perf_fd_handle; + int cpu; +@@ -116,13 +114,14 @@ ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder, + g_ptr_array_add (argv, g_strdup (PACKAGE_LIBEXECDIR "/sysprof-live-unwinder")); + g_ptr_array_add (argv, g_strdup_printf ("--stack-size=%u", stack_size)); + +- if (-1 == (event_fd = g_unix_fd_list_get (fd_list, g_variant_get_handle (arg_event_fd), &error))) ++ if (-1 == (event_fd = g_unix_fd_list_get (fd_list, g_variant_get_handle (arg_event_fd), &error)) || ++ -1 == (capture_fd = g_unix_fd_list_get (fd_list, g_variant_get_handle (arg_capture_fd), &error))) + { + g_dbus_method_invocation_return_gerror (g_steal_pointer (&invocation), error); + return TRUE; + } + +- g_ptr_array_add (argv, g_strdup_printf ("--event-fd=%u", next_target_fd)); ++ g_ptr_array_add (argv, g_strdup_printf ("--event-fd=%d", next_target_fd)); + g_subprocess_launcher_take_fd (launcher, g_steal_fd (&event_fd), next_target_fd++); + + g_variant_iter_init (&iter, arg_perf_fds); +@@ -143,32 +142,8 @@ ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder, + next_target_fd++); + } + +- g_subprocess_launcher_set_child_setup (launcher, child_setup, NULL, NULL); +- +- if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, pair) < 0) +- { +- int errsv = errno; +- g_dbus_method_invocation_return_error_literal (g_steal_pointer (&invocation), +- G_IO_ERROR, +- g_io_error_from_errno (errsv), +- g_strerror (errsv)); +- return TRUE; +- } +- +- our_fd = g_steal_fd (&pair[0]); +- their_fd = g_steal_fd (&pair[1]); +- +- out_fd_list = g_unix_fd_list_new (); +- capture_fd_handle = g_unix_fd_list_append (out_fd_list, their_fd, &error); +- +- if (capture_fd_handle < 0) +- { +- g_dbus_method_invocation_return_gerror (g_steal_pointer (&invocation), error); +- return TRUE; +- } +- + g_ptr_array_add (argv, g_strdup_printf ("--capture-fd=%d", next_target_fd)); +- g_subprocess_launcher_take_fd (launcher, g_steal_fd (&our_fd), next_target_fd++); ++ g_subprocess_launcher_take_fd (launcher, g_steal_fd (&capture_fd), next_target_fd++); + + g_ptr_array_add (argv, NULL); + +@@ -182,10 +157,7 @@ ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder, + g_message ("sysprof-live-unwinder started as process %s", + g_subprocess_get_identifier (subprocess)); + +- ipc_unwinder_complete_unwind (unwinder, +- g_steal_pointer (&invocation), +- out_fd_list, +- g_variant_new_handle (capture_fd_handle)); ++ ipc_unwinder_complete_unwind (unwinder, g_steal_pointer (&invocation), NULL); + + g_subprocess_wait_check_async (subprocess, + NULL, +diff --git a/src/sysprofd/org.gnome.Sysprof3.Unwinder.xml b/src/sysprofd/org.gnome.Sysprof3.Unwinder.xml +index fb2c7848..86b3bdbe 100644 +--- a/src/sysprofd/org.gnome.Sysprof3.Unwinder.xml ++++ b/src/sysprofd/org.gnome.Sysprof3.Unwinder.xml +@@ -17,7 +17,7 @@ + + + +- ++ + + + +-- +2.45.2 + diff --git a/0028-sysprof-live-unwinder-error-out-on-capture-failure.patch b/0028-sysprof-live-unwinder-error-out-on-capture-failure.patch new file mode 100644 index 0000000..e9494c0 --- /dev/null +++ b/0028-sysprof-live-unwinder-error-out-on-capture-failure.patch @@ -0,0 +1,31 @@ +From 6cdafd91ef71b15af66107b37a5db6b5a3dcd319 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 15:41:33 -0800 +Subject: [PATCH 28/31] sysprof-live-unwinder: error out on capture failure + +--- + src/sysprof-live-unwinder/main.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/sysprof-live-unwinder/main.c b/src/sysprof-live-unwinder/main.c +index e14eaf6c..a1cd53fa 100644 +--- a/src/sysprof-live-unwinder/main.c ++++ b/src/sysprof-live-unwinder/main.c +@@ -708,7 +708,13 @@ Examples:\n\ + return EXIT_FAILURE; + } + +- writer = sysprof_capture_writer_new_from_fd (g_steal_fd (&capture_fd), CAPTURE_BUFFER_SIZE); ++ if (!(writer = sysprof_capture_writer_new_from_fd (g_steal_fd (&capture_fd), CAPTURE_BUFFER_SIZE))) ++ { ++ int errsv = errno; ++ g_printerr ("Failed to create capture writer: %s\n", ++ g_strerror (errsv)); ++ return EXIT_FAILURE; ++ } + + if (all_perf_fds->len == 0) + { +-- +2.45.2 + diff --git a/0029-sysprofd-remove-unused-code.patch b/0029-sysprofd-remove-unused-code.patch new file mode 100644 index 0000000..4234f45 --- /dev/null +++ b/0029-sysprofd-remove-unused-code.patch @@ -0,0 +1,37 @@ +From d2d0467c28a4c2b9288cec5cfa83c42ec94c533f Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 15:53:12 -0800 +Subject: [PATCH 29/31] sysprofd: remove unused code + +--- + src/sysprofd/ipc-unwinder-impl.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/src/sysprofd/ipc-unwinder-impl.c b/src/sysprofd/ipc-unwinder-impl.c +index e6a0d7ab..2290377b 100644 +--- a/src/sysprofd/ipc-unwinder-impl.c ++++ b/src/sysprofd/ipc-unwinder-impl.c +@@ -27,7 +27,6 @@ + #include + + #include +-#include + #include + + #include +@@ -41,12 +40,6 @@ struct _IpcUnwinderImpl + IpcUnwinderSkeleton parent_instance; + }; + +-static void +-child_setup (gpointer data) +-{ +- prctl (PR_SET_PDEATHSIG, SIGKILL); +-} +- + static void + ipc_unwinder_impl_wait_cb (GObject *object, + GAsyncResult *result, +-- +2.45.2 + diff --git a/0022-sysprof-lower-libpanel-requirement.patch b/0030-build-lower-libpanel-requirement-to-ease-some-build-.patch similarity index 65% rename from 0022-sysprof-lower-libpanel-requirement.patch rename to 0030-build-lower-libpanel-requirement-to-ease-some-build-.patch index ac06eff..77f534e 100644 --- a/0022-sysprof-lower-libpanel-requirement.patch +++ b/0030-build-lower-libpanel-requirement-to-ease-some-build-.patch @@ -1,15 +1,15 @@ -From 99ca4988f59250159e179d86482be92cf731f9af Mon Sep 17 00:00:00 2001 +From 2ab855d5fdfd70948e6deeef3cfafb759d1c91f7 Mon Sep 17 00:00:00 2001 From: Christian Hergert -Date: Fri, 8 Nov 2024 10:23:59 -0800 -Subject: [PATCH] Lower libpanel build requirement to 1.4 +Date: Wed, 13 Nov 2024 15:54:12 -0800 +Subject: [PATCH 30/31] build: lower libpanel requirement to ease some build + systems -Resolves: RHEL-65743 --- src/sysprof/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build -index ab6a701a..a4f0396c 100644 +index ab6a701a..62f3441f 100644 --- a/src/sysprof/meson.build +++ b/src/sysprof/meson.build @@ -88,7 +88,7 @@ sysprof_deps = [ @@ -17,10 +17,10 @@ index ab6a701a..a4f0396c 100644 dependency('gtk4', version: gtk_req_version), dependency('libadwaita-1', version: '>= 1.6.0'), - dependency('libpanel-1', version: '>= 1.7.0'), -+ dependency('libpanel-1', version: '>= 1.4.0'), ++ dependency('libpanel-1', version: '>= 1.4'), libsysprof_static_dep, ] -- -2.46.1 +2.45.2 diff --git a/0031-build-allow-await-for-FD-with-older-libdex.patch b/0031-build-allow-await-for-FD-with-older-libdex.patch new file mode 100644 index 0000000..e3d0121 --- /dev/null +++ b/0031-build-allow-await-for-FD-with-older-libdex.patch @@ -0,0 +1,168 @@ +From d34689ff54650a581a2af3595a6f42c7d5c0166e Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 13 Nov 2024 16:20:06 -0800 +Subject: [PATCH 31/31] build: allow await for FD with older libdex + +This just makes backports easier. +--- + meson.build | 2 +- + src/libsysprof/sysprof-fd-private.h | 7 +++++ + src/libsysprof/sysprof-fd.c | 24 ++++++++++++++++ + src/libsysprof/sysprof-user-sampler.c | 28 ++----------------- + .../tests/test-live-unwinder.c | 5 ++-- + 5 files changed, 37 insertions(+), 29 deletions(-) + +diff --git a/meson.build b/meson.build +index 16d64e8a..e2a9a995 100644 +--- a/meson.build ++++ b/meson.build +@@ -45,7 +45,7 @@ need_libsysprof = (need_gtk or + get_option('tools') or + get_option('tests')) + +-dex_req = '0.9' ++dex_req = '0.8' + glib_req = '2.76.0' + gtk_req = '4.15' + polkit_req = '0.105' +diff --git a/src/libsysprof/sysprof-fd-private.h b/src/libsysprof/sysprof-fd-private.h +index 1d4dfabc..f6f11b0c 100644 +--- a/src/libsysprof/sysprof-fd-private.h ++++ b/src/libsysprof/sysprof-fd-private.h +@@ -22,6 +22,8 @@ + + #include + ++#include ++ + G_BEGIN_DECLS + + #define SYSPROF_TYPE_FD (sysprof_fd_get_type()) +@@ -36,4 +38,9 @@ void sysprof_fd_free (SysprofFD *fd); + + G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofFD, sysprof_fd_free) + ++int sysprof_await_fd (DexFuture *future, ++ GError **error); ++void sysprof_promise_resolve_fd (DexPromise *promise, ++ int fd); ++ + G_END_DECLS +diff --git a/src/libsysprof/sysprof-fd.c b/src/libsysprof/sysprof-fd.c +index 5e34f8d9..a571cefe 100644 +--- a/src/libsysprof/sysprof-fd.c ++++ b/src/libsysprof/sysprof-fd.c +@@ -65,3 +65,27 @@ sysprof_fd_dup (const SysprofFD *fd) + } + + G_DEFINE_BOXED_TYPE (SysprofFD, sysprof_fd, sysprof_fd_dup, sysprof_fd_free) ++ ++void ++sysprof_promise_resolve_fd (DexPromise *promise, ++ int fd) ++{ ++ GValue gvalue = {SYSPROF_TYPE_FD, {{.v_pointer = &fd}, {.v_int = 0}}}; ++ dex_promise_resolve (promise, &gvalue); ++} ++ ++int ++sysprof_await_fd (DexFuture *future, ++ GError **error) ++{ ++ SysprofFD *fd = dex_await_boxed (future, error); ++ int ret = -1; ++ ++ if (fd != NULL) ++ { ++ ret = sysprof_fd_steal (fd); ++ sysprof_fd_free (fd); ++ } ++ ++ return ret; ++} +diff --git a/src/libsysprof/sysprof-user-sampler.c b/src/libsysprof/sysprof-user-sampler.c +index 6079708e..05f97cbf 100644 +--- a/src/libsysprof/sysprof-user-sampler.c ++++ b/src/libsysprof/sysprof-user-sampler.c +@@ -89,30 +89,6 @@ close_fd (gpointer data) + } + } + +-static void +-promise_resolve_fd (DexPromise *promise, +- int fd) +-{ +- GValue gvalue = {SYSPROF_TYPE_FD, {{.v_pointer = &fd}, {.v_int = 0}}}; +- dex_promise_resolve (promise, &gvalue); +-} +- +-static int +-await_fd (DexFuture *future, +- GError **error) +-{ +- SysprofFD *fd = dex_await_boxed (future, error); +- int ret = -1; +- +- if (fd != NULL) +- { +- ret = sysprof_fd_steal (fd); +- sysprof_fd_free (fd); +- } +- +- return ret; +-} +- + static void + sysprof_user_sampler_ioctl (SysprofUserSampler *self, + gboolean enable) +@@ -177,7 +153,7 @@ _perf_event_open_cb (GObject *object, + if (-1 == (fd = g_unix_fd_list_get (fd_list, handle, &error))) + goto failure; + +- promise_resolve_fd (promise, g_steal_fd (&fd)); ++ sysprof_promise_resolve_fd (promise, g_steal_fd (&fd)); + return; + } + +@@ -262,7 +238,7 @@ try_again: + _perf_event_open_cb, + dex_ref (promise)); + +- if (-1 == (perf_fd = await_fd (dex_ref (promise), error))) ++ if (-1 == (perf_fd = sysprof_await_fd (dex_ref (promise), error))) + { + g_clear_pointer (&options, g_variant_unref); + +diff --git a/src/sysprof-live-unwinder/tests/test-live-unwinder.c b/src/sysprof-live-unwinder/tests/test-live-unwinder.c +index 114cc568..c3eda85a 100644 +--- a/src/sysprof-live-unwinder/tests/test-live-unwinder.c ++++ b/src/sysprof-live-unwinder/tests/test-live-unwinder.c +@@ -33,6 +33,7 @@ + + #include + ++#include "sysprof-fd-private.h" + #include "sysprof-perf-event-stream-private.h" + + #if HAVE_POLKIT_AGENT +@@ -89,7 +90,7 @@ open_perf_stream_cb (GObject *object, + + if (-1 != (fd = g_unix_fd_list_get (fd_list, handle, &error))) + { +- dex_promise_resolve_fd (promise, g_steal_fd (&fd)); ++ sysprof_promise_resolve_fd (promise, g_steal_fd (&fd)); + return; + } + } +@@ -179,7 +180,7 @@ try_again: + open_perf_stream_cb, + dex_ref (promise)); + +- fd = dex_await_fd (dex_ref (promise), error); ++ fd = sysprof_await_fd (dex_ref (promise), error); + + if (*error == NULL) + { +-- +2.45.2 + diff --git a/0019-sysprof-default-stack-capturing-as-enabled.patch b/0032-sysprof-default-stack-capturing-as-enabled.patch similarity index 100% rename from 0019-sysprof-default-stack-capturing-as-enabled.patch rename to 0032-sysprof-default-stack-capturing-as-enabled.patch diff --git a/sysprof.spec b/sysprof.spec index 16e7138..0a33bb2 100644 --- a/sysprof.spec +++ b/sysprof.spec @@ -20,29 +20,38 @@ Source1: https://github.com/libunwind/libunwind/releases/download/v%{libu %endif # Backports of debuginfod and sysprof-live-unwinder from GNOME 48 -Patch: 0001-sysprof-update-to-AdwSpinner.patch +Patch: 0001-build-add-47-version-macros.patch Patch: 0002-libsysprof-elf-do-not-allow-setting-self-as-debug-li.patch Patch: 0003-libsysprof-elf-do-not-generate-fallback-names.patch -Patch: 0004-sysprof-add-SysprofDocumentTask-abstraction.patch -Patch: 0005-libsysprof-add-setup-hooks-for-symbolizers.patch -Patch: 0006-libsysprof-hoist-fallback-symbol-creation.patch -Patch: 0007-libsysprof-add-debuginfod-symbolizer.patch -Patch: 0008-libsysprof-ensure-access-to-process-info.patch -Patch: 0009-libsysprof-fix-building-with-Ddebuginfod-auto.patch -Patch: 0010-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch -Patch: 0011-build-always-build-debuginfod-symbolizer.patch -Patch: 0012-libsysprof-remove-unnecessary-address-calculation.patch -Patch: 0013-libsysprof-add-muxer-GSource.patch -Patch: 0014-libsysprof-add-support-for-stack-regs-options-in-att.patch -Patch: 0015-sysprofd-add-support-for-unwinding-without-frame-poi.patch -Patch: 0016-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch -Patch: 0017-sysprof-cli-add-support-for-live-unwinding.patch -Patch: 0018-sysprof-add-UI-for-live-unwinding.patch -Patch: 0019-sysprof-default-stack-capturing-as-enabled.patch -Patch: 0020-live-unwinder-disable-test-in-build.patch -Patch: 0021-sysprof-user-sampler-implement-await-for-FDs.patch -Patch: 0022-sysprof-lower-libpanel-requirement.patch -Patch: 0023-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch +Patch: 0004-sysprof-update-to-AdwSpinner.patch +Patch: 0005-sysprof-add-SysprofDocumentTask-abstraction.patch +Patch: 0006-libsysprof-add-setup-hooks-for-symbolizers.patch +Patch: 0007-libsysprof-hoist-fallback-symbol-creation.patch +Patch: 0008-libsysprof-add-debuginfod-symbolizer.patch +Patch: 0009-libsysprof-ensure-access-to-process-info.patch +Patch: 0010-libsysprof-fix-building-with-Ddebuginfod-auto.patch +Patch: 0011-libsysprof-return-NULL-instance-unless-debuginfod-wo.patch +Patch: 0012-build-always-build-debuginfod-symbolizer.patch +Patch: 0013-libsysprof-remove-unnecessary-address-calculation.patch +Patch: 0014-libsysprof-add-muxer-GSource.patch +Patch: 0015-libsysprof-add-support-for-stack-regs-options-in-att.patch +Patch: 0016-sysprofd-add-support-for-unwinding-without-frame-poi.patch +Patch: 0017-libsysprof-add-SysprofUserSampler-for-live-unwinding.patch +Patch: 0018-sysprof-cli-add-support-for-live-unwinding.patch +Patch: 0019-sysprof-add-UI-for-live-unwinding.patch +Patch: 0020-sysprof-live-unwinder-ifdef-unused-code-off-x86.patch +Patch: 0021-sysprof-only-show-user-stack-sampling-on-x86.patch +Patch: 0022-libsysprof-check-for-PERF_REG_EXTENDED_MASK-availabi.patch +Patch: 0023-sysprof-live-unwinder-fix-source-func-prototype.patch +Patch: 0024-sysprof-live-unwinder-handle-large-stack-unwind-size.patch +Patch: 0025-unwinder-wait-for-completion-of-subprocess.patch +Patch: 0026-sysprof-user-sampler-implement-await-for-FDs.patch +Patch: 0027-libsysprof-provide-unwind-pipe-from-client.patch +Patch: 0028-sysprof-live-unwinder-error-out-on-capture-failure.patch +Patch: 0029-sysprofd-remove-unused-code.patch +Patch: 0030-build-lower-libpanel-requirement-to-ease-some-build-.patch +Patch: 0031-build-allow-await-for-FD-with-older-libdex.patch +Patch: 0032-sysprof-default-stack-capturing-as-enabled.patch BuildRequires: gcc BuildRequires: gcc-c++