x86_64: cmake: add rules to start the kernel under magenta_debug debugging
This commit is contained in:
@@ -6,6 +6,9 @@ endif ()
|
||||
|
||||
find_program(LLDB lldb)
|
||||
find_program(GDB gdb)
|
||||
find_program(MXDBG
|
||||
NAMES mxdbg
|
||||
HINTS ${BUILD_TOOLS_DIR})
|
||||
|
||||
set(patched_kernel ${CMAKE_CURRENT_BINARY_DIR}/kernel/${kernel_name}.elf32)
|
||||
set(generic_flags -m 128M -cpu qemu64,+rdrand)
|
||||
@@ -63,6 +66,23 @@ if (image_cdrom)
|
||||
DEPENDS ${image_cdrom})
|
||||
endif ()
|
||||
|
||||
if (MXDBG)
|
||||
message(STATUS "QEMU: Enable debugging with MXDBG")
|
||||
add_custom_target(debug-kernel-mxdbg
|
||||
COMMAND
|
||||
nohup ${QEMU}
|
||||
-kernel ${patched_kernel}
|
||||
-initrd ${sys_dir}/${bsp_name}
|
||||
--append kernel.enable-debugger
|
||||
-serial tcp::7720,server,nowait & disown
|
||||
COMMAND sleep 0.5
|
||||
&& ${MXDBG}
|
||||
-r 127.0.0.1 7720
|
||||
&& killall qemu-system-${TARGET_ARCH}
|
||||
USES_TERMINAL
|
||||
DEPENDS ${patched_kernel} bsp)
|
||||
endif ()
|
||||
|
||||
if (LLDB)
|
||||
message(STATUS "QEMU: Enable direct-kernel debug with LLDB")
|
||||
add_custom_target(debug-kernel
|
||||
@@ -71,6 +91,8 @@ if (LLDB)
|
||||
-kernel ${patched_kernel}
|
||||
-initrd ${sys_dir}/${bsp_name}
|
||||
${generic_flags}
|
||||
--append kernel.enable-debugger
|
||||
-serial tcp::7720,server,nowait
|
||||
-s -S &
|
||||
${LLDB}
|
||||
-o "file ${CMAKE_BINARY_DIR}/kernel/${kernel_name}.debug"
|
||||
|
||||
Reference in New Issue
Block a user