Print this page
12166 resync smatch to 0.6.1-rc1-il-3

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/check_debug.c
          +++ new/usr/src/tools/smatch/src/check_debug.c
↓ open down ↓ 7 lines elided ↑ open up ↑
   8    8   *
   9    9   * This program is distributed in the hope that it will be useful,
  10   10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   12   * GNU General Public License for more details.
  13   13   *
  14   14   * You should have received a copy of the GNU General Public License
  15   15   * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
  16   16   */
  17   17  
       18 +#include <string.h>
       19 +
  18   20  #include "smatch.h"
  19   21  #include "smatch_slist.h"
  20   22  #include "smatch_extra.h"
  21   23  
  22   24  void show_sname_alloc(void);
  23   25  void show_data_range_alloc(void);
  24   26  void show_ptrlist_alloc(void);
  25   27  void show_rl_ptrlist_alloc(void);
  26   28  void show_sm_state_alloc(void);
  27   29  
↓ open down ↓ 51 lines elided ↑ open up ↑
  79   81          struct sm_state *sm;
  80   82          int found = 0;
  81   83  
  82   84          check_arg = get_argument_from_call_expr(expr->args, 0);
  83   85          if (check_arg->type != EXPR_STRING) {
  84   86                  sm_error("the check_name argument to %s is supposed to be a string literal", fn);
  85   87                  return;
  86   88          }
  87   89  
  88   90          FOR_EACH_SM(__get_cur_stree(), sm) {
  89      -                if (strcmp(check_name(sm->owner), check_arg->string->data) != 0)
       91 +                if (!strstr(check_name(sm->owner), check_arg->string->data))
  90   92                          continue;
  91   93                  sm_msg("%s", show_sm(sm));
  92   94                  found = 1;
  93   95          } END_FOR_EACH_SM(sm);
  94   96  
  95   97          if (found)
  96   98                  return;
  97   99  
  98  100          if (!id_from_name(check_arg->string->data))
  99  101                  sm_msg("invalid check name '%s'", check_arg->string->data);
↓ open down ↓ 407 lines elided ↑ open up ↑
 507  509  static void match_local_debug_on(const char *fn, struct expression *expr, void *info)
 508  510  {
 509  511          local_debug = 1;
 510  512  }
 511  513  
 512  514  static void match_local_debug_off(const char *fn, struct expression *expr, void *info)
 513  515  {
 514  516          local_debug = 0;
 515  517  }
 516  518  
      519 +static void match_debug_db_on(const char *fn, struct expression *expr, void *info)
      520 +{
      521 +        debug_db = 1;
      522 +}
      523 +
      524 +static void match_debug_db_off(const char *fn, struct expression *expr, void *info)
      525 +{
      526 +        debug_db = 0;
      527 +}
      528 +
 517  529  static void match_about(const char *fn, struct expression *expr, void *info)
 518  530  {
 519  531          struct expression *arg;
 520  532          struct sm_state *sm;
 521  533          char *name;
 522  534  
 523  535          sm_msg("---- about ----");
 524  536          match_print_implied(fn, expr, NULL);
 525  537          match_buf_size(fn, expr, NULL);
 526  538          match_strlen(fn, expr, NULL);
↓ open down ↓ 239 lines elided ↑ open up ↑
 766  778          add_function_hook("__smatch_strlen", &match_strlen, NULL);
 767  779          add_function_hook("__smatch_buf_size", &match_buf_size, NULL);
 768  780          add_function_hook("__smatch_note", &match_note, NULL);
 769  781          add_function_hook("__smatch_dump_related", &match_dump_related, NULL);
 770  782          add_function_hook("__smatch_compare", &match_compare, NULL);
 771  783          add_function_hook("__smatch_debug_on", &match_debug_on, NULL);
 772  784          add_function_hook("__smatch_debug_check", &match_debug_check, NULL);
 773  785          add_function_hook("__smatch_debug_off", &match_debug_off, NULL);
 774  786          add_function_hook("__smatch_local_debug_on", &match_local_debug_on, NULL);
 775  787          add_function_hook("__smatch_local_debug_off", &match_local_debug_off, NULL);
      788 +        add_function_hook("__smatch_debug_db_on", &match_debug_db_on, NULL);
      789 +        add_function_hook("__smatch_debug_db_off", &match_debug_db_off, NULL);
 776  790          add_function_hook("__smatch_intersection", &match_intersection, NULL);
 777  791          add_function_hook("__smatch_type", &match_type, NULL);
 778  792          add_implied_return_hook("__smatch_type_rl_helper", &match_type_rl_return, NULL);
 779  793          add_function_hook("__smatch_merge_tree", &match_print_merge_tree, NULL);
 780  794          add_function_hook("__smatch_stree_id", &match_print_stree_id, NULL);
 781  795          add_function_hook("__smatch_mtag", &match_mtag, NULL);
 782  796          add_function_hook("__smatch_mtag_data", &match_mtag_data_offset, NULL);
 783  797          add_function_hook("__smatch_state_count", &match_state_count, NULL);
 784  798          add_function_hook("__smatch_mem", &match_mem, NULL);
 785  799          add_function_hook("__smatch_exit", &match_exit, NULL);
 786  800          add_function_hook("__smatch_container", &match_container, NULL);
 787  801  
 788  802          add_hook(free_old_stree, AFTER_FUNC_HOOK);
 789  803          add_hook(trace_var, STMT_HOOK_AFTER);
 790  804  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX