summaryrefslogtreecommitdiff
path: root/storage/ndb/src/common/debugger/signaldata/print.awk
diff options
context:
space:
mode:
Diffstat (limited to 'storage/ndb/src/common/debugger/signaldata/print.awk')
-rw-r--r--storage/ndb/src/common/debugger/signaldata/print.awk55
1 files changed, 55 insertions, 0 deletions
diff --git a/storage/ndb/src/common/debugger/signaldata/print.awk b/storage/ndb/src/common/debugger/signaldata/print.awk
new file mode 100644
index 00000000000..9730fb4a236
--- /dev/null
+++ b/storage/ndb/src/common/debugger/signaldata/print.awk
@@ -0,0 +1,55 @@
+BEGIN {
+ m_curr="";
+ m_count=0;
+ m_level=0;
+}
+/^[ ]*class[ ]+.*{/ {
+ if(m_curr != ""){
+ print;
+ print "ERROR: " m_curr;
+ exit;
+ }
+ m_curr = $2;
+}
+/{/ {
+ m_level++;
+}
+/bool print/{
+ m_print=$3;
+ i=index($3, "(");
+ if(i > 0){
+ m_print=substr($3, 0, i-1);
+ }
+}
+
+/[ ]+Uint32[ ]+[^)]*;/ {
+ if(m_level >= 0){
+ m=$2;
+ i=index($2, ";");
+ if(i > 0){
+ m=substr($2, 0, i-1);
+ }
+ m_members[m_count]=m;
+ m_count++;
+ }
+}
+/^[ ]*}[ ]*;/ {
+ m_level--;
+ if(m_level == 0){
+ if(m_count > 0 && m_print != ""){
+ print "bool";
+ print m_print "(FILE * output, const Uint32 * theData, ";
+ print "Uint32 len, Uint16 receiverBlockNo) {";
+ print "const " m_curr " * const sig = (" m_curr " *)theData;";
+ for(i = 0; i<m_count; i++){
+ print "fprintf(output, \" " m_members[i] ": %x\\n\", sig->" m_members[i] ");";
+ }
+ print "return true;";
+ print "}";
+ print "";
+ }
+ m_curr="";
+ m_print="";
+ m_count=0;
+ }
+}