[PATCH] Add new debug_bb_range debugging function

Jakub Jelinek jakub@redhat.com
Sat Feb 16 09:58:00 GMT 2013


On Sat, Feb 16, 2013 at 10:40:43AM +0100, Dodji Seketeli wrote:
> --- a/gcc/cfg.c
> +++ b/gcc/cfg.c
> @@ -663,6 +663,21 @@ debug_bb_n (int n)
>    return bb;
>  }
>  
> +/* Dumps cfg related information about basic blocks, from number 'S'
> +   to number E, to stderr.  */
> +
> +DEBUG_FUNCTION basic_block
> +debug_bb_range (int s, int e)
> +{
> +  basic_block bb =  NULL;
> +  for (int i = s; i <= e; ++i)
> +    {
> +      bb = BASIC_BLOCK (i);
> +      debug_bb (bb);

At some points after cfg changes, but before cfg cleanup there might be
gaps, so I think you want if (bb) debug_bb (bb);, otherwise it could crash
in that case.

	Jakub



More information about the Gcc-patches mailing list