The stack trace provides no valuable information to the user for
interactive commands. If debug output isn't enabled, print the command
result as a regular error message instead of using Jim's stacktrace
feature. This has the added benefit that syntax errors are properly marked
as such in the log.

Signed-off-by: Andreas Fritiofson <[email protected]>
---
 src/helper/command.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/helper/command.c b/src/helper/command.c
index be262f2..54267fc 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -661,7 +661,11 @@ int command_run_line(struct command_context *context, char 
*line)
                if (retval != ERROR_COMMAND_CLOSE_CONNECTION)
                {
                        /* We do not print the connection closed error message 
*/
-                       Jim_PrintErrorMessage(interp);
+                       if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
+                               Jim_PrintErrorMessage(interp);
+                       } else {
+                               LOG_ERROR("%s", 
Jim_GetString(Jim_GetResult(interp), NULL));
+                       }
                }
                if (retval == ERROR_OK)
                {
-- 
1.6.3.3

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to