1

I regularly run a GUI binary through CI tests using Github Actions. Occasionally, the binary crashes unexpectedly. This issue is difficult to reproduce, so I'd like to capture a stack trace whenever it occurs.

To achieve this, I'm using xvfb-run and gdb:

xvfb-run --auto-servernum gdb --batch -ex "run" -ex "bt full" --args ${{github.workspace}}/src/mudlet --profile 'Mudlet self-test' --mirror

However, this command always exits with code 1, which according to the xvfb-run documentation, indicates an error in the child process (gdb). I believe gdb returns this exit code because there's typically no stack trace to print.

As a workaround, I've added -ex "quit 0" to the GDB command, but this prevents the workflow from failing if a genuine crash happens.

How can I reliably capture a stack trace when the binary crashes and avoid workflow failures when no issues occur?

2
  • 1
    If you dont use gdb and your binary crashes, dont you get a core dump, which you can inspect with gdb for a stack trace? (These days systems may have a daemon that processes core dumps and hides them away somewhere, so they aren't left in the current directory anymore.) Commented Aug 11, 2024 at 18:36
  • I think that's the way to go. Thanks! Commented Aug 20, 2024 at 14:15

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.