Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
print() fails in real Android app over 1024 chars — Gideros Forum

print() fails in real Android app over 1024 chars

EricCarrEricCarr Member
edited September 2016 in General questions
After moving to the latest version, my app started crashing. I noticed that a long print() debug statement was cutting out at 1024 characters and crashes with the following message:

A/libc: stack corruption detected
A/libc: Fatal signal 6 (SIGABRT) at 0x00007689 (code=-6), thread 32141 (Thread-2910)

I assume this is related to the change to output print() to logcat. Any ideas?

Thanks,
Eric

Comments

  • EricCarrEricCarr Member
    edited September 2016
    UPDATE : Apparently the 1024 byte is a limit imposed by adb/logcat. So, we have no choice but to split or truncate.

    So, here is my workaround method (and the limit is technically 1022 characters) that splits the output if not in the gideros player:
    function printSafe(d)
    	if application:isPlayerMode() then print(d) return end 	
    	local max=1022
    	local i, i2, len =1, 1, string.len(d)
    	while i<len do
    		i2 = i + max-1
    		if i2 > len then i2 = len end
    		print(string.sub(d,i,i2))
    		i = i2+1
    	end
    end

    Likes: MikeHart, antix, hgy29

    +1 -1 (+3 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    Nice catch, we should split whatever ends up in logcat automatically in gideros core code
Sign In or Register to comment.