Skip to content

Commit

Permalink
chg: Adds support for showing in the status bar when waiting for GDB …
Browse files Browse the repository at this point in the history
…connection.
  • Loading branch information
lcgamboa committed Aug 3, 2024
1 parent c714d19 commit a2eff07
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ PACKAGE=picsimlab
MAINVER=0
MINORVER=9
VERSION=0.9.2
DATE=240720
DATE=240803
VERSION_STABLE=0.9.1
12 changes: 8 additions & 4 deletions src/boards/bsim_qemu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,6 @@ void bsim_qemu::EvThreadRun(void) {
}
}
}
if (PICSimLab.GetDebugStatus()) {
strcpy(argv[argc++], "-gdb");
sprintf(argv[argc++], "tcp::%i", PICSimLab.GetDebugPort());
}

if ((icount >= 0) && (icount < 11)) {
strcpy(argv[argc++], "-icount");
Expand All @@ -870,6 +866,13 @@ void bsim_qemu::EvThreadRun(void) {

if (ConfigWaitGdb) {
strcpy(argv[(argc)++], "-S");
PICSimLab.SetDebugStatus(1);
PICSimLab.SetCpuState(CPU_WAITING_GDB);
}

if (PICSimLab.GetDebugStatus()) {
strcpy(argv[argc++], "-gdb");
sprintf(argv[argc++], "tcp::%i", PICSimLab.GetDebugPort());
}

BoardOptions(&argc, argv);
Expand Down Expand Up @@ -1190,6 +1193,7 @@ const picpin* bsim_qemu::MGetPinsValues(void) {
}

void bsim_qemu::MStep(void) {
PICSimLab.SetCpuState(CPU_RUNNING);
if (ioupdated) {
for (int id = 0; id < 2; id++) {
if (master_i2c[id].ctrl_on) {
Expand Down
11 changes: 10 additions & 1 deletion src/lib/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@
#ifndef TYPES_H
#define TYPES_H

enum PICSimlabCPUState { CPU_RUNNING, CPU_STEPPING, CPU_HALTED, CPU_BREAKPOINT, CPU_ERROR, CPU_POWER_OFF, CPU_LAST };
enum PICSimlabCPUState {
CPU_RUNNING,
CPU_STEPPING,
CPU_HALTED,
CPU_BREAKPOINT,
CPU_ERROR,
CPU_POWER_OFF,
CPU_WAITING_GDB,
CPU_LAST
};

enum PICSimlabStatus { PS_RUN = 0, PS_DEBUG, PS_SERIAL, PS_LAST };

Expand Down
3 changes: 3 additions & 0 deletions src/picsimlab1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ void CPWindow1::timer2_EvOnTime(CControl* control) {
case CPU_ERROR:
statusbar1.SetField(0, "Error!");
break;
case CPU_WAITING_GDB:
statusbar1.SetField(0, "Waiting for GDB...");
break;
}
}

Expand Down

0 comments on commit a2eff07

Please sign in to comment.