X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fdbgcnt.def;h=e3ac8eaf1aecc04a44640b89f32a9b647eea3ede;hb=c7447c8278c8ef10ab99630497871370df3bdd4c;hp=5c0b7496d7d87842b917621f1f689f3ce29a53e1;hpb=3072d30e7983a3ca5ad030f1f98a5c39bcc2c07b;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index 5c0b7496d7d..e3ac8eaf1ae 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -1,11 +1,11 @@ /* This file contains the list of the debug counter for GCC. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later +Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY @@ -14,9 +14,8 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. */ +along with GCC; see the file COPYING3. If not see +. */ /* A debug counter provides you a way to count an event @@ -33,7 +32,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA How does it work ? - Everytime dbg_cnt(named-counter) is called, + Every time dbg_cnt(named-counter) is called, the counter is incremented for the named-counter. And the incremented value is compared against the threshold (limit) specified by the option. @@ -62,23 +61,126 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA Use -fdbg-cnt=counter1:N,counter2:M,... which sets the limit for counter1 to N, and the limit for counter2 to M, etc. e.g. setting a limit to zero will make dbg_cnt () return false *always*. + + The following shell file can then be used to binary search for + exact transformation that causes the bug. A second shell script + should be written, say "tryTest", which exits with 1 if the + compiled program fails and exits with 0 if the program succeeds. + This shell script should take 1 parameter, the value to be passed + to set the counter of the compilation command in tryTest. Then, + assuming that the following script is called binarySearch, + the command: + + binarySearch tryTest + + will automatically find the highest value of the counter for which + the program fails. If tryTest never fails, binarySearch will + produce unpredictable results as it will try to find an upper bound + that does not exist. + + When dbgcnt does hits the limit, it writes a comment in the current + dump_file of the form: + + ***dbgcnt: limit reached for %s.*** + + Assuming that the dump file is logging the analysis/transformations + it is making, this pinpoints the exact position in the log file + where the problem transformation is being logged. + +===================================== +#!/bin/bash + +while getopts "l:u:i:" opt +do + case $opt in + l) lb="$OPTARG";; + u) ub="$OPTARG";; + i) init="$OPTARG";; + ?) usage; exit 3;; + esac +done + +shift $(($OPTIND - 1)) +echo $@ +cmd=${1+"${@}"} + +lb=${lb:=0} +init=${init:=100} + +$cmd $lb +lb_val=$? +if [ -z "$ub" ]; then + # find the upper bound + ub=$(($init + $lb)) + true + while [ $? -eq $lb_val ]; do + ub=$(($ub * 10)) + #ub=`expr $ub \* 10` + $cmd $ub + done +fi + +echo command: $cmd + +true +while [ `expr $ub - $lb` -gt 1 ]; do + try=$(($lb + ( $ub - $lb ) / 2)) + $cmd $try + if [ $? -eq $lb_val ]; then + lb=$try + else + ub=$try + fi +done + +echo lbound: $lb +echo ubound: $ub + +===================================== + */ /* Debug counter definitions. */ DEBUG_COUNTER (auto_inc_dec) +DEBUG_COUNTER (ccp) +DEBUG_COUNTER (cfg_cleanup) DEBUG_COUNTER (cse2_move2add) +DEBUG_COUNTER (cprop) DEBUG_COUNTER (dce) +DEBUG_COUNTER (dce_fast) +DEBUG_COUNTER (dce_ud) DEBUG_COUNTER (delete_trivial_dead) +DEBUG_COUNTER (df_byte_scan) DEBUG_COUNTER (dse) +DEBUG_COUNTER (dse1) +DEBUG_COUNTER (dse2) DEBUG_COUNTER (gcse2_delete) +DEBUG_COUNTER (global_alloc_at_func) +DEBUG_COUNTER (global_alloc_at_reg) +DEBUG_COUNTER (graphite_scop) +DEBUG_COUNTER (hoist) +DEBUG_COUNTER (hoist_insn) DEBUG_COUNTER (ia64_sched2) +DEBUG_COUNTER (if_conversion) +DEBUG_COUNTER (if_conversion_tree) +DEBUG_COUNTER (if_after_combine) +DEBUG_COUNTER (if_after_reload) DEBUG_COUNTER (local_alloc_for_sched) DEBUG_COUNTER (postreload_cse) +DEBUG_COUNTER (pre) DEBUG_COUNTER (pre_insn) +DEBUG_COUNTER (treepre_insert) +DEBUG_COUNTER (tree_sra) +DEBUG_COUNTER (eipa_sra) DEBUG_COUNTER (sched2_func) DEBUG_COUNTER (sched_block) DEBUG_COUNTER (sched_func) DEBUG_COUNTER (sched_insn) DEBUG_COUNTER (sched_region) +DEBUG_COUNTER (sel_sched_cnt) +DEBUG_COUNTER (sel_sched_region_cnt) +DEBUG_COUNTER (sel_sched_insn_cnt) +DEBUG_COUNTER (sms_sched_loop) +DEBUG_COUNTER (store_motion) DEBUG_COUNTER (split_for_sched2) DEBUG_COUNTER (tail_call)