Long string arguments can make the -Xtrace:invoke-verbose output
huge so we should trim long strings.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 jit/trace-jit.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/jit/trace-jit.c b/jit/trace-jit.c
index 9615cb5..d2c8dc1 100644
--- a/jit/trace-jit.c
+++ b/jit/trace-jit.c
@@ -474,6 +474,8 @@ static void print_array(struct vm_object *obj)
 static void print_arg(enum vm_type arg_type, const unsigned long *args,
                      int *arg_index)
 {
+       const int MAX_STRING_LENGTH = 50;
+
        if (arg_type == J_LONG || arg_type == J_DOUBLE) {
                union {
                        unsigned long long ullvalue;
@@ -529,9 +531,19 @@ static void print_arg(enum vm_type arg_type, const 
unsigned long *args,
 
                if (obj->class == vm_java_lang_String) {
                        char *str;
+                       int len;
 
                        str = vm_string_to_cstr(obj);
-                       trace_printf("= \"%s\"", str);
+                       len = strlen(str);
+
+                       if (len > MAX_STRING_LENGTH) {
+                               str[MAX_STRING_LENGTH] = 0;
+                               trace_printf("= \"%s\" (...%d more)", str,
+                                            len - MAX_STRING_LENGTH);
+                       } else {
+                               trace_printf("= \"%s\"", str);
+                       }
+
                        free(str);
                }
 
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to