https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116602

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:69b2d523b1069651053cd39dc9b4810a2c7f964a

commit r15-4393-g69b2d523b1069651053cd39dc9b4810a2c7f964a
Author: David Malcolm <dmalc...@redhat.com>
Date:   Wed Oct 16 13:10:11 2024 -0400

    diagnostics: capture backtraces in SARIF notifications [PR116602]

    This patch makes the SARIF output's crash handler attempt to capture
    a backtrace in JSON form within the notification's property bag.  The
    precise format of the property is subject to change, but, for example,
    in one of the test cases I got output like this:

    "properties": {"gcc/backtrace": {"frames": [{"pc": "0x7f39c610a32d",
                                                 "function":
"pass_crash_test::execute(function*)",
                                                 "filename":
"/home/david/gcc-newgit/src/gcc/testsuite/gcc.dg/plugin/crash_test_plugin.c",
                                                 "lineno": 98}]}}}],

    The backtrace code is based on that in diagnostic.cc.

    gcc/ChangeLog:
            PR other/116602
            * diagnostic-format-sarif.cc: Include "demangle.h" and
            "backtrace.h".
            (sarif_invocation::add_notification_for_ice): Add "backtrace"
            param and pass it to ctor.
            (sarif_ice_notification::sarif_ice_notification): Add "backtrace"
            param and add it to property bag.
            (bt_stop): New, taken from diagnostic.cc.
            (struct bt_closure): New.
            (bt_callback): New, adapted from diagnostic.cc.
            (sarif_builder::make_stack_from_backtrace): New.
            (sarif_builder::on_report_diagnostic): Attempt to get backtrace
            and pass it to add_notification_for_ice.

    gcc/testsuite/ChangeLog:
            PR other/116602
            * gcc.dg/plugin/crash-test-ice-in-header-sarif-2_1.py: Add check
            for backtrace.
            * gcc.dg/plugin/crash-test-ice-in-header-sarif-2_2.py: Likewise.

    Signed-off-by: David Malcolm <dmalc...@redhat.com>
  • [Bug other/116602] RFE: capture... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to