summaryrefslogtreecommitdiff
path: root/src/helper/log.c
diff options
context:
space:
mode:
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-12-15 09:43:26 +0000
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-12-15 09:43:26 +0000
commit47d044934727c3d5a57658ddd324b407dd73860a (patch)
tree936d222cf6a2f84f714e3750169c31c34984ea1e /src/helper/log.c
parent459d03e3bb516cfe7ea641718084885ffda070f4 (diff)
downloadopenocd+libswd-47d044934727c3d5a57658ddd324b407dd73860a.tar.gz
openocd+libswd-47d044934727c3d5a57658ddd324b407dd73860a.tar.bz2
openocd+libswd-47d044934727c3d5a57658ddd324b407dd73860a.tar.xz
openocd+libswd-47d044934727c3d5a57658ddd324b407dd73860a.zip
- add ability for openocd to communicate to gdb using pipes (stdin/stdout).
- this is enabled by new command line option option --pipe. git-svn-id: svn://svn.berlios.de/openocd/trunk@1242 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper/log.c')
-rw-r--r--src/helper/log.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/helper/log.c b/src/helper/log.c
index d21b8e9f..8e320084 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -31,6 +31,7 @@
#include "configuration.h"
#include "time_support.h"
#include "command.h"
+#include "server.h"
#include <stdio.h>
#include <stdlib.h>
@@ -108,9 +109,11 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
#endif
string);
}
- else
+ else if(server_use_pipes == 0)
{
- if (strcmp(string, "\n")!=0)
+ /* if we are using gdb through pipes then we do not want any output
+ * to the pipe otherwise we get repeated strings */
+ if (strcmp(string, "\n") != 0)
{
/* print human readable output - but skip empty lines */
fprintf(log_output, "%s%s",
@@ -203,6 +206,18 @@ int handle_debug_level_command(struct command_context_s *cmd_ctx, char *cmd, cha
if (debug_level > 3)
debug_level = 3;
+ if (debug_level >= LOG_LVL_DEBUG && server_use_pipes == 1)
+ {
+ /* if we are enabling debug info then we need to write to a log file
+ * otherwise the pipe will get full and cause issues with gdb */
+ FILE* file = fopen("openocd.log", "w");
+ if (file)
+ {
+ log_output = file;
+ LOG_WARNING("enabling log output as we are using pipes");
+ }
+ }
+
return ERROR_OK;
}