-
- Downloads
btf: improve -dA comments for testsuite
Many BTF type kinds refer to other types via index to the final types list. However, the order of the final types list is not guaranteed to remain the same for the same source program between different runs of the compiler, making it difficult to test inter-type references. This patch updates the assembler comments output when writing a given BTF record to include minimal information about the referenced type, if any. This allows for the regular expressions used in the gcc testsuite to do some basic integrity checks on inter-type references. For example, for the type unsigned int * Assembly comments like the following are written with -dA: .4byte 0 ; TYPE 2 BTF_KIND_PTR '' .4byte 0x2000000 ; btt_info: kind=2, kflag=0, vlen=0 .4byte 0x1 ; btt_type: (BTF_KIND_INT 'unsigned int') Several BTF tests which can immediately be made more robust with this change are updated. It will also be useful in new tests for the upcoming btf_type_tag support. gcc/ * btfout.cc (btf_kind_names): New. (btf_kind_name): New. (btf_absolute_var_id): New utility function. (btf_relative_var_id): Likewise. (btf_relative_func_id): Likewise. (btf_absolute_datasec_id): Likewise. (btf_asm_type_ref): New. (btf_asm_type): Update asm comments and use btf_asm_type_ref (). (btf_asm_array): Likewise. Accept ctf_container_ref parameter. (btf_asm_varent): Likewise. (btf_asm_func_arg): Likewise. (btf_asm_datasec_entry): Likewise. (btf_asm_datasec_type): Likewise. (btf_asm_func_type): Likewise. Add index parameter. (btf_asm_enum_const): Likewise. (btf_asm_sou_member): Likewise. (output_btf_vars): Update btf_asm_* call accordingly. (output_asm_btf_sou_fields): Likewise. (output_asm_btf_enum_list): Likewise. (output_asm_btf_func_args_list): Likewise. (output_asm_btf_vlen_bytes): Likewise. (output_btf_func_types): Add ctf_container_ref parameter. Pass it to btf_asm_func_type. (output_btf_datasec_types): Update btf_asm_datsec_type call similarly. (btf_output): Update output_btf_func_types call similarly. gcc/testsuite/ * gcc.dg/debug/btf/btf-array-1.c: Use new BTF asm comments in scan-assembler expressions where useful. * gcc.dg/debug/btf/btf-anonymous-struct-1.c: Likewise. * gcc.dg/debug/btf/btf-anonymous-union-1.c: Likewise. * gcc.dg/debug/btf/btf-bitfields-2.c: Likewise. * gcc.dg/debug/btf/btf-bitfields-3.c: Likewise. * gcc.dg/debug/btf/btf-datasec-2.c: Likewise. * gcc.dg/debug/btf/btf-enum-1.c: Likewise. * gcc.dg/debug/btf/btf-function-6.c: Likewise. * gcc.dg/debug/btf/btf-pointers-1.c: Likewise. * gcc.dg/debug/btf/btf-struct-1.c: Likewise. * gcc.dg/debug/btf/btf-struct-2.c: Likewise. * gcc.dg/debug/btf/btf-typedef-1.c: Likewise. * gcc.dg/debug/btf/btf-union-1.c: Likewise. * gcc.dg/debug/btf/btf-variables-1.c: Likewise. * gcc.dg/debug/btf/btf-variables-2.c: Likewise. Update outdated comment. * gcc.dg/debug/btf/btf-function-3.c: Update outdated comment.
Showing
- gcc/btfout.cc 180 additions, 47 deletionsgcc/btfout.cc
- gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c 2 additions, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c 2 additions, 2 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c 3 additions, 0 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-array-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c
- gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c
- gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c 2 additions, 2 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c
- gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c 4 additions, 0 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-function-3.c
- gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c 2 additions, 2 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-function-6.c
- gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c 3 additions, 0 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c 3 additions, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c
- gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c 7 additions, 7 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/debug/btf/btf-union-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c 6 additions, 0 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c
- gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c 5 additions, 2 deletionsgcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c
Loading
Please register or sign in to comment