summaryrefslogtreecommitdiffstats
path: root/opengl/libs/GLES2_dbg/generate_debug_in.py
diff options
context:
space:
mode:
authorDavid Li <davidxli@google.com>2011-03-01 16:08:10 -0800
committerDavid Li <davidxli@google.com>2011-03-03 18:28:43 -0800
commit28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2 (patch)
treef6bcb82ff2a68a5bd30218326def0f95fb6734f2 /opengl/libs/GLES2_dbg/generate_debug_in.py
parente5f823ccf1cce4cab5699f1a07c1ee2290a69169 (diff)
downloadframeworks_base-28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2.zip
frameworks_base-28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2.tar.gz
frameworks_base-28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2.tar.bz2
Initial commit of GLESv2 debugger server
Use debug.egl.debug_proc property to match process cmdline. Binds to TCP:5039 and waits for client connection. Sends function call parameters, textures and shaders using Protobuf. Java Eclipse client plug-in is next. Change-Id: I183b755263663f87e86dde1ad12f527d0445fd57 Signed-off-by: David Li <davidxli@google.com>
Diffstat (limited to 'opengl/libs/GLES2_dbg/generate_debug_in.py')
-rwxr-xr-xopengl/libs/GLES2_dbg/generate_debug_in.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/opengl/libs/GLES2_dbg/generate_debug_in.py b/opengl/libs/GLES2_dbg/generate_debug_in.py
new file mode 100755
index 0000000..830bcb9
--- /dev/null
+++ b/opengl/libs/GLES2_dbg/generate_debug_in.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+
+def append_functions(functions, lines):
+ i = 0
+ for line in lines:
+ if line.find("API_ENTRY(") >= 0: # a function prototype
+ returnType = line[0: line.find(" API_ENTRY(")]
+ functionName = line[line.find("(") + 1: line.find(")")] #extract GL function name
+ parameterList = line[line.find(")(") + 2: line.find(") {")]
+
+ functions.append(functionName)
+ #print functionName
+ continue
+
+ parameters = parameterList.split(',')
+ paramIndex = 0
+ if line.find("*") >= 0:
+ print "// FIXME: this function has pointers, it should be hand written"
+ externs.append("%s Tracing_%s(%s);" % (returnType, functionName, parameterList))
+ print "%s Tracing_%s(%s)\n{" % (returnType, functionName, parameterList)
+
+ if parameterList == "void":
+ parameters = []
+
+ arguments = ""
+
+ for parameter in parameters:
+ parameter = parameter.replace("const", "")
+ parameter = parameter.strip()
+ paramType = parameter.split(' ')[0]
+ paramName = parameter.split(' ')[1]
+
+ paramIndex += 1
+
+ return functions
+
+
+
+if __name__ == "__main__":
+ definedFunctions = []
+ lines = open("gl2_api.in").readlines()
+ definedFunctions = append_functions(definedFunctions, lines)
+
+ output = open("debug.in", "w")
+ lines = open("trace.in").readlines()
+ output.write("// the following functions are not defined in GLESv2_dbg\n")
+ for line in lines:
+ functionName = ""
+ if line.find("TRACE_GL(") >= 0: # a function prototype
+ functionName = line.split(',')[1].strip()
+ elif line.find("TRACE_GL_VOID(") >= 0: # a function prototype
+ functionName = line[line.find("(") + 1: line.find(",")] #extract GL function name
+ else:
+ continue
+ if functionName in definedFunctions:
+ #print functionName
+ continue
+ else:
+ output.write(line)
+