mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:22:45 +00:00 
			
		
		
		
	 46c60fd451
			
		
	
	
		46c60fd451
		
	
	
	
	
		
			
			Introduce the 'debug-kernel' script to allow developers to quickly attach a debugger to the QEMU debug remote. The setting (-s) is already enabled by ./run today when using QEMU for virtualisation. If the system is running under QEMU, the debugger will break in when the script is run. If you add the -S option to QEMU it will wait for the debugger to connect before booting the kernel. This allows you to debug the init/boot process. Personally I use cgdb instead of gdb, so I opted to make the debugger used by the script customizable via an environment variable. This change also adds -g3 to the kernel build so that rich debug symbols are available in the kernel binary.
		
			
				
	
	
		
			14 lines
		
	
	
	
		
			474 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			474 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| # Set this environment variable to override the default debugger.
 | |
| #
 | |
| [ -z "$SERENITY_KERNEL_DEBUGGER" ] && SERENITY_KERNEL_DEBUGGER="gdb"
 | |
| 
 | |
| # The QEMU -s option (enabled by default in ./run) sets up a debugger
 | |
| # remote on localhost:1234. So point our debugger there, and inform
 | |
| # the debugger which binary to load symbols, etc from.
 | |
| #
 | |
| $SERENITY_KERNEL_DEBUGGER \
 | |
|     -ex "file $(pwd)/kernel" \
 | |
|     -ex 'set arch i386:intel' \
 | |
|     -ex 'target remote localhost:1234'
 |