Skip to content

Commit f4e0af1

Browse files
committed
add detailed gdb support
1 parent 0c8dd13 commit f4e0af1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,17 @@ QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
123123
then echo "-gdb tcp::15234"; \
124124
else echo "-s -p 15234"; fi)
125125

126-
debug: build/kernel .gdbinit $(F)/fs-copy.img
127-
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB) &
128-
sleep 1
129-
$(GDB)
126+
debug: build/kernel .gdbinit
127+
@tmux new-session -d \
128+
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB) && \
129+
tmux split-window -h "$(GDB) -ex 'target remote localhost:15234'" && \
130+
tmux -2 attach-session -d
131+
132+
gdbserver: build/kernel
133+
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB)
134+
135+
gdbclient:
136+
$(GDB) -ex "target remote localhost:15234"
130137

131138
CHAPTER ?= $(shell git rev-parse --abbrev-ref HEAD | grep -oP 'ch\K[0-9]')
132139

0 commit comments

Comments
 (0)