[patch] Add discriminators to DWARF line table

Diego Novillo dnovillo@google.com
Tue Jun 2 20:38:00 GMT 2009


On Wed, Apr 29, 2009 at 19:20, Cary Coutant <ccoutant@google.com> wrote:

>        * basic-block.h (struct basic_block_def): Add discriminator field.
>        * dbxout.c (dbxout_source_line): Add new parameter.  Change all
>        callers.
>        * debug.c (do_nothing_debug_hooks): Add additional entry.
>        (debug_nothing_int_charstar_int): New function.
>        * debug.h (struct gcc_debug_hooks): Add parameter to source_line
>        hook.
>        (debug_nothing_int_charstar_int): New declaration.
>        * dwarf2out.c (dwarf2out_source_line): Add new parameter.  Write
>        discriminator value in .loc directive.
>        * final.c (last_discriminator): New variable.
>        (discriminator): New variable.
>        (final_start_function): Initialize above variables, pass current
>        discriminator to debug hook.
>        (notice_source_line): Check for discriminator change.
>        * gimple-pretty-print.c (dump_bb_header): Print discriminator value.
>        * sdbout.c (sdbout_source_line): New parameter.
>        * tree-cfg.c (struct locus_discrim_map): New structure type.
>        (discriminator_per_locus): New hash table.
>        (build_gimple_cfg): Allocate and free discriminator hash table.
>        (make_edges): Call assign_discriminator.
>        (locus_map_hash): New function.
>        (locus_map_eq): New function.
>        (next_discriminator_for_locus): New function.
>        (same_line_p): New function.
>        (assign_discriminator): New function.
>        (make_cond_expr_edges): Call assign_discriminator.
>        (make_gimple_switch_edges): Likewise.
>        (first_non_label_stmt): New function.
>        * vmsdbgout.c (vmsdbgout_source_line): Add new parameter.  Change
>        all callers.
>        * xcoffout.c (xcoffout_source_line): Add new parameter.
>
>        * configure.ac (gcc_cv_as_discriminator): New configury check for
>        gas support for discriminator.
>        * configure: Regenerate.
>        * config.in: Regenerate.

OK with:

>  #ifndef DWARF2_FRAME_INFO
> @@ -3243,7 +3243,7 @@ dwarf2out_begin_prologue (unsigned int l
>       prologue case, not the eh frame case.  */
>  #ifdef DWARF2_DEBUGGING_INFO
>    if (file)
> -    dwarf2out_source_line (line, file);
> +    dwarf2out_source_line (line, file, 0);

For a line that uses no discriminators, is 'file:line:0' the same
as 'file:line'?  I expect, yes.  Should we support a
discriminator other than 0 to be the 'no discriminator' setting?
I don't know what the standard says, so this may be a silly
question.

> @@ -91,6 +99,9 @@ static void make_edges (void);
>  static void make_cond_expr_edges (basic_block);
>  static void make_gimple_switch_edges (basic_block);
>  static void make_goto_expr_edges (basic_block);
> +static unsigned int locus_map_hash (const void*);
> +static int locus_map_eq (const void*, const void*);

Space before '*'.

> +/* Trivial hash function for a location_t.  */
> +
> +static unsigned int
> +locus_map_hash (const void* item)

Document ITEM.  Space before '*'.

> +/* Equality function for the locus-to-discriminator map.  */
> +
> +static int
> +locus_map_eq (const void* va, const void* vb)

Document VA and VB.  Space before '*'.

> +{
> +  const struct locus_discrim_map* a = (const struct locus_discrim_map*) va;
> +  const struct locus_discrim_map* b = (const struct locus_discrim_map*) vb;

Likewise.

> +  from = expand_location (locus1);
> +  to = expand_location (locus2);
> +  return (from.file == to.file && from.line == to.line);

Are file name strings canonicalized by the location_t code?  I
assume they are, but I'm not sure.  If not, you may need a better
matching code here.


Diego.



More information about the Gcc-patches mailing list