Skip to content
denbeuteld edited this page Nov 20, 2022 · 10 revisions

Back-tracing Olive with GDB

  1. Install GDB

    • Ubuntu/LinuxMint: sudo apt install gdb
    • Arch Linux: sudo pacman -S gdb
    • macOS: Install Homebrew and run brew install gdb on a terminal.
    • Windows: Install MSYS2 and run, on the MSYS shell, pacman -S mingw-w64-x86_64-gdb.
  2. Launch your OS' main command line. These could be found by searching "terminal" on your OS' search bar

  3. Type gdb in the command line to start GDB. You should get a message like this:

    bash-5.0$ gdb
    GNU gdb (GDB) Fedora 9.1-6.fc32
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-redhat-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    (gdb)
    
  4. See the last line (gdb)? Type exec-file ~/OlivePath next to it and press enter

    • It should look like (gdb) exec-file ~/Downloads/Olive-27a4dbc8-x86_64.AppImage
    • NOTE: Leave your command line application open until you are done with debugging.
  5. Type run to launch Olive.

  6. Crash Olive, go back to the command line with (gdb) and type bt.

    • If you get the message --Type <RET> for more, q to quit, c to continue without paging--, just press c.
  7. Copy everything that came out of 'bt' into a text file or something.


As you note, after typing gdb you have to wait gdb to run to type exec-file ~/OlivePath

If you prefer to do it in one line and/or create a script:

gdb -ex=run --args /path/to/olive.AppImage


NOTE: Back-traces look like this

(gdb) bt
#0  0x00000000005886ff in olive::Timecode::timestamp_to_timecode (
    timestamp=@0x7fffffffcda0: 0, timebase=..., 
    display=@0x7fffffffcd9c: olive::Timecode::kTimecodeDropFrame, 
    show_plus_if_positive=show_plus_if_positive@entry=false)
    at /home/travis/build/olive-editor/olive/app/common/timecodefunctions.cpp:112
#1  0x00000000006c300e in olive::TimeSlider::ValueToString (this=0x174c7e0, 
    v=...)
    at /home/travis/build/olive-editor/olive/app/widget/slider/timeslider.cpp:53
#2  0x00000000006c076b in olive::SliderBase::UpdateLabel (this=0x174c7e0, v=...)
    at /home/travis/build/olive-editor/olive/app/widget/slider/sliderbase.cpp:224

Each number is an event of a function that took place within Olive's code.

For example: event #2 means that line 224 in sliderbase.cpp was used at that moment


If you are building olive from git, the application will by default not have debug symbols.

mkdir Debug
cd Debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
cd app
gdb --args olive-editor