Debug symbols do not contain godot files

Godot Version

4.2

Question

I am attempting to build Godot from source and debug it in gdb. I am on windows using mingw. My build command is scons -j 5 platform=windows target=editor use_mingw=yes dev_build=yes separate_debug_symbols=yes. Unfortunately gdb is unable to put breakpoints in godot files. It seems they are not contained in the .debugsymbols file, because they do not come up with autocomplete for break command. Anyone knows the solution?

gdb output:

PS C:\Program_Files\Godot\godot\bin> gdb .\godot.windows.editor.dev.x86_64.exe
GNU gdb (GDB) 14.2
Copyright (C) 2023 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-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 .\godot.windows.editor.dev.x86_64.exe...
Reading symbols from C:\Program_Files\Godot\godot\bin\godot.windows.editor.dev.x86_64.exe.debugsymbols...
(gdb) break main_loop:60
No source file named main_loop.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) break
break        break-range
(gdb) break
break        break-range
(gdb) break
Display all 200 possibilities? (y or n)
CommandLineToArgvA(char*, int*)
CrashHandler::CrashHandler()
CrashHandler::disable()
CrashHandler::initialize()
CrashHandler::~CrashHandler()
DisplayServerWindows::_get_focused_window_or_popup() const
DisplayServerWindows::_get_screens_origin() const
DisplayServerWindows::_get_window_style(bool, bool, bool, bool, bool, bool, bool, unsigned long&, unsigned long&)
DisplayServerWindows::_register_raw_input_devices(int)
DisplayServerWindows::_set_mouse_mode_impl(DisplayServer::MouseMode)
DisplayServerWindows::_update_real_mouse_position(int)
DisplayServerWindows::_update_window_mouse_passthrough(int)
DisplayServerWindows::_update_window_style(int, bool)
DisplayServerWindows::can_any_window_draw() const
DisplayServerWindows::clipboard_get() const
DisplayServerWindows::clipboard_get_image() const
DisplayServerWindows::clipboard_has() const
DisplayServerWindows::clipboard_has_image() const
DisplayServerWindows::clipboard_set(String const&)
DisplayServerWindows::create_sub_window(DisplayServer::WindowMode, DisplayServer::VSyncMode, unsigned int, Rect2i const&)
DisplayServerWindows::cursor_get_shape() const
DisplayServerWindows::cursor_set_custom_image(Ref<Resource> const&, DisplayServer::CursorShape, Vector2 const&)
DisplayServerWindows::cursor_set_shape(DisplayServer::CursorShape)
DisplayServerWindows::delete_sub_window(int)
DisplayServerWindows::file_dialog_show(String const&, String const&, String const&, bool, DisplayServer::FileDialogMode, Vector<String> const&, Callable const&)
DisplayServerWindows::get_keyboard_focus_screen() const
DisplayServerWindows::get_name() const
DisplayServerWindows::get_primary_screen() const
DisplayServerWindows::get_screen_count() const
DisplayServerWindows::get_window_at_screen_position(Vector2i const&) const
DisplayServerWindows::get_window_list() const
DisplayServerWindows::gl_window_make_current(int)
DisplayServerWindows::has_feature(DisplayServer::Feature) const
DisplayServerWindows::ime_get_selection() const
DisplayServerWindows::ime_get_text() const
DisplayServerWindows::mouse_get_button_state() const
DisplayServerWindows::mouse_get_mode() const
DisplayServerWindows::mouse_get_position() const
DisplayServerWindows::mouse_set_mode(DisplayServer::MouseMode)
DisplayServerWindows::screen_get_dpi(int) const
DisplayServerWindows::screen_get_image(int) const
DisplayServerWindows::screen_get_pixel(Vector2i const&) const
DisplayServerWindows::screen_get_position(int) const
DisplayServerWindows::screen_get_refresh_rate(int) const
DisplayServerWindows::screen_get_size(int) const
DisplayServerWindows::screen_get_usable_rect(int) const
DisplayServerWindows::screen_is_kept_on() const
DisplayServerWindows::screen_set_keep_on(bool)
DisplayServerWindows::show_window(int)
DisplayServerWindows::tts_get_voices() const
DisplayServerWindows::tts_is_paused() const
DisplayServerWindows::tts_is_speaking() const
DisplayServerWindows::tts_pause()
DisplayServerWindows::tts_resume()
DisplayServerWindows::tts_speak(String const&, String const&, int, float, float, int, bool)
DisplayServerWindows::tts_stop()
DisplayServerWindows::warp_mouse(Vector2i const&)
DisplayServerWindows::window_attach_instance_id(ObjectID, int)
DisplayServerWindows::window_can_draw(int) const
DisplayServerWindows::window_get_attached_instance_id(int) const
DisplayServerWindows::window_get_current_screen(int) const
DisplayServerWindows::window_get_flag(DisplayServer::WindowFlags, int) const
DisplayServerWindows::window_get_max_size(int) const
DisplayServerWindows::window_get_min_size(int) const
DisplayServerWindows::window_get_mode(int) const
DisplayServerWindows::window_get_native_handle(DisplayServer::HandleType, int) const
DisplayServerWindows::window_get_position(int) const
DisplayServerWindows::window_get_position_with_decorations(int) const
DisplayServerWindows::window_get_size(int) const
DisplayServerWindows::window_get_size_with_decorations(int) const
DisplayServerWindows::window_get_title_size(String const&, int) const
DisplayServerWindows::window_is_focused(int) const
DisplayServerWindows::window_is_maximize_allowed(int) const
DisplayServerWindows::window_move_to_foreground(int)
DisplayServerWindows::window_request_attention(int)
DisplayServerWindows::window_set_current_screen(int, int)
DisplayServerWindows::window_set_drop_files_callback(Callable const&, int)
DisplayServerWindows::window_set_exclusive(int, bool)
DisplayServerWindows::window_set_flag(DisplayServer::WindowFlags, bool, int)
DisplayServerWindows::window_set_ime_active(bool, int)
DisplayServerWindows::window_set_ime_position(Vector2i const&, int)
DisplayServerWindows::window_set_input_event_callback(Callable const&, int)
DisplayServerWindows::window_set_input_text_callback(Callable const&, int)
DisplayServerWindows::window_set_max_size(Vector2i, int)
DisplayServerWindows::window_set_min_size(Vector2i, int)
DisplayServerWindows::window_set_mode(DisplayServer::WindowMode, int)
DisplayServerWindows::window_set_mouse_passthrough(Vector<Vector2> const&, int)
DisplayServerWindows::window_set_position(Vector2i const&, int)
DisplayServerWindows::window_set_rect_changed_callback(Callable const&, int)
DisplayServerWindows::window_set_size(Vector2i, int)
DisplayServerWindows::window_set_title(String const&, int)
DisplayServerWindows::window_set_transient(int, int)
DisplayServerWindows::window_set_window_event_callback(Callable const&, int)
HandlerRoutine(unsigned long)
OS_Windows::OS_Windows(HINSTANCE__*)
OS_Windows::_check_internal_feature_support(String const&)
OS_Windows::_get_default_fontname(String const&) const
OS_Windows::_quote_command_line_argument(String const&) const
OS_Windows::_stretch_to_dw(int) const
OS_Windows::_weight_to_dw(int) const
OS_Windows::alert(String const&, String const&)
OS_Windows::close_dynamic_library(void*)
OS_Windows::create_process(String const&, List<String, DefaultAllocator> const&, long long*, bool)
OS_Windows::delay_usec(unsigned int) const
OS_Windows::delete_main_loop()
OS_Windows::disable_crash_handler()
OS_Windows::execute(String const&, List<String, DefaultAllocator> const&, String*, int*, bool, MutexImpl<mingw_stdthread::recursive_mutex>*, bool)
OS_Windows::finalize()
OS_Windows::finalize_core()
OS_Windows::get_cache_path() const
OS_Windows::get_config_path() const
OS_Windows::get_data_path() const
OS_Windows::get_datetime(bool) const
OS_Windows::get_distribution_name() const
OS_Windows::get_dynamic_library_symbol_handle(void*, String, void*&, bool)
OS_Windows::get_embedded_pck_offset() const
OS_Windows::get_entropy(unsigned char*, int)
OS_Windows::get_environment(String const&) const
OS_Windows::get_executable_path() const
OS_Windows::get_godot_dir_name() const
OS_Windows::get_locale() const
OS_Windows::get_main_loop() const
OS_Windows::get_memory_info() const
OS_Windows::get_name() const
OS_Windows::get_process_id() const
OS_Windows::get_processor_name() const
OS_Windows::get_stdin_string()
OS_Windows::get_system_ca_certificates()
OS_Windows::get_system_dir(OS::SystemDir, bool) const
OS_Windows::get_system_font_path(String const&, int, int, bool) const
OS_Windows::get_system_font_path_for_text(String const&, String const&, String const&, String const&, int, int, bool) const
OS_Windows::get_system_fonts() const
OS_Windows::get_ticks_usec() const
OS_Windows::get_time_zone_info() const
OS_Windows::get_unique_id() const
OS_Windows::get_unix_time() const
OS_Windows::get_user_data_dir() const
OS_Windows::get_version() const
OS_Windows::get_video_adapter_driver_info() const
OS_Windows::has_environment(String const&) const
OS_Windows::initialize()
OS_Windows::initialize_debugging()
OS_Windows::is_disable_crash_handler() const
OS_Windows::is_process_running(long long const&) const
OS_Windows::kill(long long const&)
OS_Windows::move_to_trash(String const&)
OS_Windows::open_dynamic_library(String, void*&, bool, String*)
OS_Windows::run()
OS_Windows::set_cwd(String const&)
OS_Windows::set_environment(String const&, String const&) const
OS_Windows::set_main_loop(MainLoop*)
OS_Windows::shell_open(String)
OS_Windows::shell_show_in_file_manager(String, bool)
OS_Windows::unset_environment(String const&) const
OS_Windows::~OS_Windows()
QueryDpiForMonitor(HMONITOR__*, _MonitorDpiType)
RedirectIOToConsole()
RedirectStream(char const*, char const*, _iobuf*, unsigned long)
WinMain-
WinMainCRTStartup
_MonitorEnumProcCount(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcDpi(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcOrigin(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcPos(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcPrim(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcRefreshRate(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcScreen(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcSize(HMONITOR__*, HDC__*, tagRECT*, long long)
_MonitorEnumProcUsableSize(HMONITOR__*, HDC__*, tagRECT*, long long)
__gcc_deregister_frame
__gcc_register_frame
__mingw_invalidParameterHandler
__tcf_10
__tcf_150
__tcf_151
__tcf_33
__tcf_7-
__tmainCRTStartup
_append_to_pipe(char*, int, String*, MutexImpl<mingw_stdthread::recursive_mutex>*)
_error_handler(void*, char const*, char const*, int, char const*, char const*, bool, ErrorHandlerType)
_main()-
atexit--
debug_dynamic_library_check_dependencies(String const&, String const&, HashSet<String, HashMapHasherDefault, HashMapComparatorDefault<String> >&, HashSet<String, HashMapHasherDefault, HashMapComparatorDefault<String> >&)
encode_uint16(unsigned short, unsigned char*)
encode_uint32(unsigned int, unsigned char*)
fastmod(unsigned int, unsigned long long, unsigned int)
format_error_message(unsigned long)
get_shift_from_power_of_2(unsigned int)
hash_fmix32(unsigned int)
hash_one_uint64(unsigned long long)
is_wow64()
mainre--
mainCRTStartup
next_power_of_2(unsigned int)
pre_c_init
pre_cpp_init
track_mouse_leave_event(HWND__*)
unsigned int nearest_power_of_2_templated<unsigned int>(unsigned int)
wc_to_utf8(wchar_t const*)
widechar_main(int, wchar_t**)
*** List may be truncated, max-completions reached. ***
(gdb) break
No default breakpoint address now.

I had this same issue with my C++|GDExtension module. It was ultimately fixed by adding debug_symbols=yes to my scons command. without it, -s is passed to g++|clang++ which strips debug symbols.

You can use the file command (in linux) to see if your executable/library is stripped:

file Godot_v4.3-stable_mono_linux.x86_64 

Example output:

Godot_v4.3-stable_mono_linux.x86_64:
ELF 64-bit LSB executable,
x86-64,
version 1 (SYSV),
dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
for GNU/Linux 5.15.0,
stripped

Notice the stripped output. This indicates that the binary does not include debug symbols.

The file command is typically for linux but i’m sure you can use WSL on windows to execute it just the same. I hope this helps!

EDIT

After investigating further, is seems that using dev_build=yes (which you do) is actually already building with debug info included (while also removing optimizations). Please disregard this post. Sorry.