From fc7b68944dab0d3cd695722eb430260935e51716 Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Tue, 15 Feb 2011 19:48:36 +0300 Subject: [PATCH] Add optional -DDEBUG to Makefile. --- build/Makefile | 3 ++- src/gdb-server.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build/Makefile b/build/Makefile index 076f974..c50747f 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,4 +1,5 @@ PRG := st-util +DEBUG := #-DDEBUG all: $(PRG) @@ -13,7 +14,7 @@ $(PRG): $(OBJS) %.o: ../src/%.c gcc -O3 -g3 -Wall -Werror -c -std=gnu99 -MMD -MP \ - -fno-strict-aliasing -Wno-unused \ + -fno-strict-aliasing -Wno-unused $(DEBUG) \ -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"\ -o "$@" "$<" diff --git a/src/gdb-server.c b/src/gdb-server.c index ad38c64..ef30a02 100644 --- a/src/gdb-server.c +++ b/src/gdb-server.c @@ -95,7 +95,9 @@ int serve(struct stlink* sl, int port) { return 1; } - //printf("recv: %s\n", packet); + #ifdef DEBUG + printf("recv: %s\n", packet); + #endif char* reply = NULL; @@ -246,7 +248,9 @@ int serve(struct stlink* sl, int port) { } if(reply) { - //printf("send: %s\n", reply); + #ifdef DEBUG + printf("send: %s\n", reply); + #endif int result = gdb_send_packet(client, reply); if(result != 0) { -- 2.30.2