Print this page
12724 update smatch to 0.6.1-rc1-il-5

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_data/db/mark_function_ptrs_searchable.pl
          +++ new/usr/src/tools/smatch/src/smatch_data/db/mark_function_ptrs_searchable.pl
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15  $db->do("PRAGMA temp_store = MEMORY");
  16   16  $db->do("PRAGMA locking = EXCLUSIVE");
  17   17  
  18   18  my ($update, $sth, $fn_ptr, $ptr_to_ptr, $count);
  19   19  
  20   20  $update = $db->prepare_cached('UPDATE function_ptr set searchable = 1 where ptr = ?');
  21   21  $sth = $db->prepare('select distinct(ptr) from function_ptr;');
  22   22  $sth->execute();
  23   23  
  24   24  while ($fn_ptr = $sth->fetchrow_array()) {
  25      -
  26      -    # following a pointer to pointer chain is too complicated for now
  27      -    $ptr_to_ptr = $db->selectrow_array("select function from function_ptr where ptr = '$fn_ptr' and function like '% %';");
  28      -    if ($ptr_to_ptr) {
  29      -        next;
  30      -    }
  31      -    $ptr_to_ptr = $db->selectrow_array("select function from function_ptr where ptr = '$fn_ptr' and function like '%[]';");
  32      -    if ($ptr_to_ptr) {
  33      -        next;
  34      -    }
  35      -
  36   25      $count = $db->selectrow_array("select count(*) from return_states join function_ptr where return_states.function == function_ptr.function and ptr = '$fn_ptr';");
  37   26      # if there are too many states then bail
  38   27      if ($count > 1000) {
  39   28          next;
  40   29      }
  41   30      # if there are no states at all then don't bother recording
  42   31      if ($count == 0) {
  43   32          next;
  44   33      }
  45   34  
  46   35      $update->execute($fn_ptr);
  47   36  }
  48   37  
  49   38  $db->commit();
  50   39  $db->disconnect();
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX