diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index de2f097503..9956e119a3 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -418,10 +418,14 @@ add_custom_command( COMMAND ${CMAKE_OBJCOPY} -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${KERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Kernel COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh COMMAND ${CMAKE_COMMAND} -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh - BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Kernel ${CMAKE_CURRENT_BINARY_DIR}/kernel.map + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug + COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel + BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel.map ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel.debug" DESTINATION boot) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res) serenity_install_headers(Kernel) diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh index 922d6d52ef..185c9b31db 100755 --- a/Meta/build-root-filesystem.sh +++ b/Meta/build-root-filesystem.sh @@ -97,6 +97,7 @@ fi chmod 0400 mnt/res/kernel.map chmod 0400 mnt/boot/Kernel +chmod 0400 mnt/boot/Kernel.debug chmod 600 mnt/etc/shadow chmod 755 mnt/res/devel/templates/*.postcreate echo "done" diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index 9cc62861c4..8c5909fe10 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -31,7 +31,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con const ELF::Image* elf = nullptr; if (containing_function.value().address_low >= 0xc0000000) { - auto file_or_error = MappedFile::map("/boot/Kernel"); + auto file_or_error = MappedFile::map("/boot/Kernel.debug"); if (file_or_error.is_error()) return; kernel_elf = make(file_or_error.value()->bytes()); diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index b12720062f..7dd9b99502 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -42,7 +42,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node) FlatPtr base_address = 0; if (m_node.address() >= 0xc0000000) { if (!m_kernel_file) { - auto file_or_error = MappedFile::map("/boot/Kernel"); + auto file_or_error = MappedFile::map("/boot/Kernel.debug"); if (file_or_error.is_error()) return; m_kernel_file = file_or_error.release_value(); diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index dacce6f7a6..b16d319dc1 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -201,7 +201,7 @@ Result, String> Profile::load_from_perfcore_file(const St auto& object = json.value().as_object(); - auto file_or_error = MappedFile::map("/boot/Kernel"); + auto file_or_error = MappedFile::map("/boot/Kernel.debug"); OwnPtr kernel_elf; if (!file_or_error.is_error()) kernel_elf = make(file_or_error.value()->bytes()); diff --git a/Userland/Libraries/LibSymbolication/Symbolication.cpp b/Userland/Libraries/LibSymbolication/Symbolication.cpp index c16fcf46a6..b0caa7749b 100644 --- a/Userland/Libraries/LibSymbolication/Symbolication.cpp +++ b/Userland/Libraries/LibSymbolication/Symbolication.cpp @@ -84,7 +84,7 @@ Vector symbolicate_thread(pid_t pid, pid_t tid) regions.append(RegionWithSymbols { .base = 0xc0000000, .size = 0x3fffffff, - .path = "/boot/Kernel", + .path = "/boot/Kernel.debug", .is_relative = false }); {