libsysprof-analyze: include final address context

We may need to know the final address context so we can inject symbols as
necessary into the top of the callgraph. We know it when generating the
symbols, so just yield it to the caller too.
This commit is contained in:
Christian Hergert
2023-05-25 11:15:07 -07:00
parent 1b0434c854
commit 6f90a552e7
4 changed files with 19 additions and 5 deletions

View File

@ -1062,6 +1062,8 @@ sysprof_document_list_jitmaps (SysprofDocument *self)
* @traceable: the traceable to extract symbols for
* @symbols: an array to store #SysprofSymbols
* @n_symbols: the number of elements in @symbols
* @final_context: (out) (nullable): a location to store the last address
* context of the stack trace.
*
* Batch symbolizing of a traceable.
*
@ -1074,7 +1076,8 @@ guint
sysprof_document_symbolize_traceable (SysprofDocument *self,
SysprofDocumentTraceable *traceable,
SysprofSymbol **symbols,
guint n_symbols)
guint n_symbols,
SysprofAddressContext *final_context)
{
SysprofAddressContext last_context = SYSPROF_ADDRESS_CONTEXT_NONE;
const SysprofProcessInfo *process_info;
@ -1087,7 +1090,7 @@ sysprof_document_symbolize_traceable (SysprofDocument *self,
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_TRACEABLE (traceable), 0);
if (n_symbols == 0 || symbols == NULL)
return 0;
goto finish;
pid = sysprof_document_frame_get_pid (SYSPROF_DOCUMENT_FRAME (traceable));
process_info = g_hash_table_lookup (self->pid_to_process_info, GINT_TO_POINTER (pid));
@ -1107,6 +1110,10 @@ sysprof_document_symbolize_traceable (SysprofDocument *self,
last_context = context;
}
finish:
if (final_context)
*final_context = last_context;
return n_symbolized;
}