Gdb / MacOS / RawTherapee-debug problem

Info about the debug build I have:

   Version: 5.1
    Branch: 5.1
    Commit: f23d70fd
    Commit date: 2017-05-15
    Compiler: clang-mp-3 3.9.1
    Processor: generic x86
    System: Apple
    Bit depth: 64 bits
    Gtkmm: V3.16.0
    Build type: debug
    Build flags: -arch x86_64 -std=c++11 -mtune=generic -Werror=unused-label -mmacosx-version-min=10.9 -fopenmp=libomp -Werror=unknown-pragmas -Wall -Wno-unused-result -Wno-deprecated-declarations -g
    Link flags:  -mtune=generic -headerpad_max_install_names
    OpenMP support: ON
    MMAP support: ON

This is what happens when trying to run thru gdb. GDB is code signed, matching repo-rt/build directory is in place, etc.

    sudo gdb /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin
    Password:
    GNU gdb (GDB) 7.12.1
    Copyright (C) 2017 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-apple-darwin16.5.0".
    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"...
    Reading symbols from /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin...done.
    (gdb) run
    Starting program: /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin 
    During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
    (gdb) bt
    No stack.
    (gdb) 

Wondering where either I’m getting the gdb usage wrong, or building with wrong cmake parameters for debug.

Thanks for reading.

The CMake line looks fine.

Why did you use sudo? There is no need for that as far as I’m aware. Try running RawTherapee through GDB without sudo.

You could also try compiling with -O0 (oscar zero, no optimization), worth a shot.

I used sudo because gdb thought it still needed to be codesigned otherwise:

gdb /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin 
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 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-apple-darwin16.5.0".
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"...
Reading symbols from /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin...done.
(gdb) run
Starting program: /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin 
Unable to find Mach task port for process-id 52301: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

Running sudo gdb rawtherapee does not work on my system, and running RawTherapee as root is not advised.

https://stackoverflow.com/a/13914219
Codesigning the Debugger - GNAT User's Guide

Thanks, I just resigned gdb, but now get this error.

gdb /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin 
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 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-apple-darwin16.5.0".
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"...
Reading symbols from /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin...done.
(gdb) run
Starting program: /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin 
During startup program terminated with signal ?, Unknown signal.
(gdb) bt
No stack.
(gdb)

Used the -O0 flag in CXXFLAGS, but still get the error:

gdb /Applications/RawTherapee.app/Contents/MacOS/rawtherapee-bin 
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 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-apple-darwin16.5.0".
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"...
Reading symbols from /Applications/RawTherapee.app/Contents/MacOS/rawtherapee-bin...done.
(gdb) run
Starting program: /Applications/RawTherapee.app/Contents/MacOS/rawtherapee-bin 
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
(gdb) bt
No stack.

Version: 5.1
Branch: 5.1
Commit: f23d70fd
Commit date: 2017-05-15
Compiler: clang-mp-3 3.9.1
Processor: generic x86
System: Apple
Bit depth: 64 bits
Gtkmm: V3.16.0
Build type: debug
Build flags: -arch x86_64 -O0 -std=c++11 -mtune=generic -Werror=unused-label -mmacosx-version-min=10.9 -fopenmp=libomp -Werror=unknown-pragmas -Wall -Wno-unused-result -Wno-deprecated-declarations -g
Link flags: -mtune=generic -headerpad_max_install_names
OpenMP support: ON
MMAP support: ON

might just be that the versions of clang and gdb that you are using don’t like to talk to each other. you could try with lldb

OK @agriggio, lldb seems to work, sorta:

lldb /Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin 
(lldb) target create "/Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
    import six
ImportError: No module named six
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>

That error gets repeated a zillion times here…
then…

NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Current executable set to '/Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin' (x86_64).
(lldb) run
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Process 8161 launched: '/Applications/RawTherapee-debug.app/Contents/MacOS/rawtherapee-bin' (x86_64)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>

Again this error gets repeated a zillion times…
then …

NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
objc[8161]: Class GNotificationCenterDelegate is implemented in both /Applications/RawTherapee-debug.app/Contents/Frameworks/libgio-2.0.0.dylib (0x101b8dfc0) and /opt/local/lib/libgio-2.0.0.dylib (0x109a03fc0). One of the two will be used. Which one is undefined.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): Gdk-WARNING **: GdkQuartzDisplay does not implement the monitor vfuncs

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): glibmm-WARNING **: Failed to wrap object of type 'gtkmm_CustomObject_iface_properties'. Hint: this error is commonly caused by failing to call a library init() function.

(rawtherapee-bin:8161): Gtk-CRITICAL **: gtk_window_set_default_icon: assertion 'GDK_IS_PIXBUF (icon)' failed
Process 8161 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x0000000109676749 libgobject-2.0.0.dylib`g_object_unref + 161
libgobject-2.0.0.dylib`g_object_unref:
->  0x109676749 <+161>: movq   $0x0, (%rax)
    0x109676750 <+168>: movq   (%rbx), %rdi
    0x109676753 <+171>: movq   %rdi, %rsi
    0x109676756 <+174>: callq  0x109693100               ; symbol stub for: g_slist_delete_link
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x0000000109676749 libgobject-2.0.0.dylib`g_object_unref + 161
    frame #1: 0x00000001025260fc libgtk-3.0.dylib`gtk_window_set_default_icon_from_file + 37
    frame #2: 0x0000000101e862ea libgtkmm-3.0.1.dylib`Gtk::Window::set_default_icon_from_file(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 40
    frame #3: 0x0000000100536386 rawtherapee-bin`RTWindow::RTWindow(this=0x00000001097482b0) at rtwindow.cc:100
    frame #4: 0x0000000100360054 rawtherapee-bin`main(argc=1, argv=0x00007fff5fbff7a0) at main.cc:372
    frame #5: 0x00007fff9aa1f235 libdyld.dylib`start + 1
(lldb) 

And so it fizzles. So lldb /seems/ to work, but I do get this crash.

well, unfortunately I’m afraid I can’t help further, as I currently have no Mac to test :frowning:

@HIRAM Seems, you’re not alone with that problem: Maybe this bugzilla thread gives some answers. (Disclaimer: The only thing I ever did with MacOS was to replace it with Linux. :grin:)

I did get lldb to run the debug build but I had to pass the terminal all the variables set up by the executable loader. Will have to try this with gdb later.