Browse Source

add debug.isGDBConnected()

pull/2/head
Fernando Trias 4 years ago
parent
commit
d469a097bd
  1. 2
      TeensyDebug.h
  2. 3
      gdbstub.cpp

2
TeensyDebug.h

@ -74,6 +74,7 @@ int hcdebug_setBreakpoint(int n);
size_t gdb_out_write(const uint8_t *msg, size_t len); size_t gdb_out_write(const uint8_t *msg, size_t len);
int gdb_file_io(const char *msg); int gdb_file_io(const char *msg);
extern int file_io_errno; extern int file_io_errno;
extern int gdb_active_flag;
#define O_CREAT 0x200 #define O_CREAT 0x200
#define O_APPEND 8 #define O_APPEND 8
@ -117,6 +118,7 @@ public:
uint32_t getRegister(const char *reg); uint32_t getRegister(const char *reg);
int setRegister(const char *reg, uint32_t value); int setRegister(const char *reg, uint32_t value);
int restoreRunMode(); int restoreRunMode();
int isGDBConnected() { return gdb_active_flag; }
virtual size_t write(uint8_t b) { virtual size_t write(uint8_t b) {
return write(&b, 1); return write(&b, 1);

3
gdbstub.cpp

@ -953,6 +953,8 @@ int process_k(const char *cmd, char *result) {
return 0; return 0;
} }
int gdb_active_flag = 0;
/** /**
* @brief Process a command by calling appropriate delegation function * @brief Process a command by calling appropriate delegation function
* *
@ -961,6 +963,7 @@ int process_k(const char *cmd, char *result) {
* @return int 0 * @return int 0
*/ */
int processCommand(const char *cmd, char *result) { int processCommand(const char *cmd, char *result) {
gdb_active_flag = 1;
switch(cmd[0]) { switch(cmd[0]) {
case 'g': return process_g(cmd, result); case 'g': return process_g(cmd, result);
case 'G': return process_G(cmd, result); case 'G': return process_G(cmd, result);

Loading…
Cancel
Save