Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2a521f6

Browse files
authored
Merge pull request #74 from RinHizakura/gdbstub
Support GDB stub for remote debugging
2 parents b2e2de7 + ae260eb commit 2a521f6

File tree

5 files changed

+242
-77
lines changed

5 files changed

+242
-77
lines changed

‎.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
path = cnfa
33
url = https://github.com/cntools/cnfa
44
shallow = true
5+
[submodule "mini-gdbstub"]
6+
path = mini-gdbstub
7+
url = https://github.com/RinHizakura/mini-gdbstub
8+
shallow = true

‎Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ OBJS := \
105105

106106
deps := $(OBJS:%.o=.%.o.d)
107107

108+
GDBSTUB_LIB := mini-gdbstub/build/libgdbstub.a
109+
LDFLAGS += $(GDBSTUB_LIB)
110+
mini-gdbstub/Makefile:
111+
git submodule update --init $(dir $@)
112+
$(GDBSTUB_LIB): mini-gdbstub/Makefile
113+
$(MAKE) -C $(dir $<)
114+
$(OBJS): $(GDBSTUB_LIB)
115+
108116
$(BIN): $(OBJS)
109117
$(VECHO) " LD\t$@\n"
110118
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
@@ -152,6 +160,7 @@ build-image:
152160

153161
clean:
154162
$(Q)$(RM) $(BIN) $(OBJS) $(deps)
163+
$(Q)$(MAKE) -C mini-gdbstub clean
155164

156165
distclean: clean
157166
$(Q)$(RM) riscv-harts.dtsi

‎device.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,11 @@ bool virtio_snd_init(virtio_snd_state_t *vsnd);
355355

356356
/* memory mapping */
357357
typedef struct {
358+
bool debug;
358359
bool stopped;
359360
uint32_t *ram;
360361
uint32_t *disk;
362+
vm_t vm;
361363
plic_state_t plic;
362364
u8250_state_t uart;
363365
#if SEMU_HAS(VIRTIONET)
@@ -376,4 +378,10 @@ typedef struct {
376378
#if SEMU_HAS(VIRTIOSND)
377379
virtio_snd_state_t vsnd;
378380
#endif
381+
382+
uint32_t peripheral_update_ctr;
383+
384+
/* The fields used for debug mode */
385+
bool is_interrupted;
386+
int curr_cpuid;
379387
} emu_state_t;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /