Execution paths¶
-
type
diagnostic_execution_path¶
A diagnostic can optionally contain a diagnostic_execution_path
describing a path of execution through code.
-
diagnostic_execution_path *
diagnostic_add_execution_path(diagnostic *diag)¶ Create and borrow a pointer to an execution path for
diag.The path is automatically cleaned up when
diagis finished.diagmust be non-NULL.
-
diagnostic_execution_path *
diagnostic_manager_new_execution_path(diagnostic_manager *diag_mgr)¶ Create a new execution path. This is owned by the caller and must have either
diagnostic_take_execution_path()ordiagnostic_execution_path_release()called on it.diag_mgrmust be non-NULL.
-
void
diagnostic_take_execution_path(diagnostic *diag, diagnostic_execution_path *path)¶ Set
diagto usepathas its execution path, taking ownership ofpath.Both parameters must be non-NULL.
-
void
diagnostic_execution_path_release(diagnostic_execution_path *path)¶ Release ownership of
path, which must not have been taken by a diagnostic.
-
type
diagnostic_event_id¶
A diagnostic_event_id identifies a particular event within a
diagnostic_execution_path and can be used for expressing
cross-references between events. In particular FIXME
-
diagnostic_event_id
diagnostic_execution_path_add_event(diagnostic_execution_path *path, const diagnostic_physical_location *physical_loc, const diagnostic_logical_location *logical_loc, unsigned stack_depth, const char *fmt, ...)¶ Append an event to the end of
path, which must be non-NULL.physical_loccan be NULL, or non-NULL to associate the event with adiagnostic_physical_location.logical_loccan be NULL, or non-NULL to associate the event with adiagnostic_logical_location.stack_depthis for use in interprocedural paths and identifies the depth of the stack at the event. Purely intraprocedural paths should use a stack depth of 1 for their eventsfmtmust be non-NULL. See Message formatting for details of how to use it.
-
diagnostic_event_id
diagnostic_execution_path_add_event_va(diagnostic_execution_path *path, const diagnostic_physical_location *physical_loc, const diagnostic_logical_location *logical_loc, unsigned stack_depth, const char *fmt, va_list *args)¶ Equivalent to
diagnostic_execution_path_add_event(), but using ava_listrather than directly taking variadic arguments.
-
diagnostic_event_id diagnostic_execution_path_add_event_via_msg_buf (diagnostic_execution_path *path, const diagnostic_physical_location *physical_loc, const diagnostic_logical_location *logical_loc, unsigned stack_depth, -
diagnostic_message_buffer *msg_buf) This is equivalent to
diagnostic_execution_path_add_event()but using a message buffer rather than a format string and variadic arguments.pathandmsg_bufmust both be non-NULL.Calling this function transfers ownership of
msg_bufto the path - do not calldiagnostic_message_buffer_release()on it.This function was added in LIBGDIAGNOSTICS_ABI_3; you can test for its presence using
#ifdef LIBDIAGNOSTICS_HAVE_diagnostic_message_buffer
Paths are printed to text sinks, and for SARIF sinks each path is added as
a codeFlow object (see SARIF 2.1.0
§3.36 codeFlow object).