debugger: changed dprintcalls argument to limit number of displayed calls; fixed...
authorBotond Baranyi <botond.baranyi@ericsson.com>
Wed, 20 Jul 2016 12:08:32 +0000 (14:08 +0200)
committerBotond Baranyi <botond.baranyi@ericsson.com>
Wed, 20 Jul 2016 12:08:32 +0000 (14:08 +0200)
Change-Id: I234ee29060574fe5ff3de50d717b209899f5d2e9
Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
compiler2/DebuggerStuff.cc
compiler2/ttcn3/AST_ttcn3.cc
core/Debugger.cc

index 955f462bdac7eac540fa318007cbab09653f353f..2fbbd2864c001a5d207ee9603bec691d9787cd19 100644 (file)
@@ -123,7 +123,6 @@ void calculate_type_name_and_debug_functions_from_type(Type* p_type,
   else if (p_type_last->is_structured_type() ||
            p_type_last->get_typetype() == Type::T_ENUM_A ||
            p_type_last->get_typetype() == Type::T_ENUM_T ||
-           p_type_last->get_typetype() == Type::T_PORT ||
            p_type_last->get_typetype() == Type::T_SIGNATURE ||
            p_type_last->get_typetype() == Type::T_FUNCTION ||
            p_type_last->get_typetype() == Type::T_ALTSTEP ||
@@ -165,6 +164,9 @@ void calculate_type_name_and_debug_functions_from_type(Type* p_type,
       // these ASN.1 string types are not converted right by Type::get_typetype_ttcn3()
       p_type_name = "universal charstring";
       break;
+    case Type::T_PORT:
+      p_type_name = "port";
+      break;
     case Type::T_UNRESTRICTEDSTRING:
     case Type::T_EMBEDDED_PDV:
     case Type::T_EXTERNAL:
index 6859e36cc11c7b90c97f61bc1d2e7e2f15091a43..44ecabe0635ff9df5293a07dfc0fa9fb32db4a23 100644 (file)
@@ -2918,7 +2918,8 @@ namespace Ttcn {
       Def_Type* def = dynamic_cast<Def_Type*>(asss->get_ass_byIndex(i));
       if (def != NULL) {
         Type* t = def->get_Type();
-        if (!t->is_ref() && t->get_typetype() != Type::T_COMPONENT) {
+        if (!t->is_ref() && t->get_typetype() != Type::T_COMPONENT &&
+            t->get_typetype() != Type::T_PORT) {
           // don't generate code for subtypes
           if (t->get_typetype() != Type::T_SIGNATURE) {
             print_str = mputprintf(print_str, 
@@ -2927,30 +2928,26 @@ namespace Ttcn {
               "  }\n"
               , (print_str != NULL) ? "else " : ""
               , t->get_dispname().c_str(), t->get_genname_value(this).c_str());
-            if (t->get_typetype() != Type::T_PORT) {
-              overwrite_str = mputprintf(overwrite_str,
-                "  %sif (!strcmp(p_var.type_name, \"%s\")) {\n"
-                "    ((%s*)p_var.value)->set_param(p_new_value);\n"
-                "  }\n"
-                , (overwrite_str != NULL) ? "else " : ""
-                , t->get_dispname().c_str(), t->get_genname_value(this).c_str());
-            }
+            overwrite_str = mputprintf(overwrite_str,
+              "  %sif (!strcmp(p_var.type_name, \"%s\")) {\n"
+              "    ((%s*)p_var.value)->set_param(p_new_value);\n"
+              "  }\n"
+              , (overwrite_str != NULL) ? "else " : ""
+              , t->get_dispname().c_str(), t->get_genname_value(this).c_str());
           }
-          if (t->get_typetype() != Type::T_PORT) {
-            print_str = mputprintf(print_str,
+          print_str = mputprintf(print_str,
+            "  %sif (!strcmp(p_var.type_name, \"%s template\")) {\n"
+            "    ((const %s_template*)ptr)->log();\n"
+            "  }\n"
+            , (print_str != NULL) ? "else " : ""
+            , t->get_dispname().c_str(), t->get_genname_value(this).c_str());
+          if (t->get_typetype() != Type::T_SIGNATURE) {
+            overwrite_str = mputprintf(overwrite_str,
               "  %sif (!strcmp(p_var.type_name, \"%s template\")) {\n"
-              "    ((const %s_template*)ptr)->log();\n"
+              "    ((%s_template*)p_var.value)->set_param(p_new_value);\n"
               "  }\n"
-              , (print_str != NULL) ? "else " : ""
+              , (overwrite_str != NULL) ? "else " : ""
               , t->get_dispname().c_str(), t->get_genname_value(this).c_str());
-            if (t->get_typetype() != Type::T_SIGNATURE) {
-              overwrite_str = mputprintf(overwrite_str,
-                "  %sif (!strcmp(p_var.type_name, \"%s template\")) {\n"
-                "    ((%s_template*)p_var.value)->set_param(p_new_value);\n"
-                "  }\n"
-                , (overwrite_str != NULL) ? "else " : ""
-                , t->get_dispname().c_str(), t->get_genname_value(this).c_str());
-            }
           }
         }
       }
index d9b3a96f520a1e1e7394ac19f57c111654295b14..7bae62626341e08989d7417956021b2e16d20223 100644 (file)
@@ -576,20 +576,25 @@ void TTCN3_Debugger::print_function_calls(const char* p_amount)
                function_calls.buffer.start == (function_calls.buffer.end + 1) %
                function_calls.buffer.size) ?
     function_calls.buffer.size : function_calls.buffer.end + 1;
+  bool invalid_arg = false;
   if (p_amount == NULL || strcmp(p_amount, "all") == 0) {
     amount = limit;
   }
   else if (is_numeric(p_amount)) {
     amount = strtol(p_amount, NULL, 10);
-    if (amount == 0 || amount > limit) {
-      print(DRET_NOTIFICATION, "Invalid number of function calls. Expected 1 - %d.",
-        limit);
-      return;
+    if (amount == 0) {
+      invalid_arg = true;
+    }
+    else if (amount > limit) {
+      amount = limit;
     }
   }
   else {
-    print(DRET_NOTIFICATION, "Argument 1 is invalid. Expected 'all' or integer "
-      "value (number of calls).");
+    invalid_arg = true;
+  }
+  if (invalid_arg) {
+    print(DRET_NOTIFICATION, "Argument 1 is invalid. Expected 'all' or non-zero "
+      "integer value (number of calls).");
     return;
   }
   for (int i = (function_calls.buffer.end - amount + function_calls.buffer.size + 1) %
@@ -1230,6 +1235,9 @@ CHARSTRING TTCN3_Debugger::print_base_var(const TTCN3_Debugger::variable_t& p_va
   else if (!strcmp(p_var.type_name, "component template")) {
     ((const COMPONENT_template*)ptr)->log();
   }
+  else if (!strcmp(p_var.type_name, "port")) {
+    ((const PORT*)ptr)->log(); // virtual
+  }
   else if (!strcmp(p_var.type_name, "default")) {
     ((const DEFAULT*)ptr)->log();
   }
This page took 0.029516 seconds and 5 git commands to generate.