[PATCH 2/3] libsframe: testsuite: refactor findfre-1 for clarity

Jan Beulich jbeulich@suse.com
Wed May 21 06:20:59 GMT 2025


On 20.05.2025 21:03, Indu Bhagat wrote:
> The testcase had usages of some magic numbers, making it difficult to
> keep up when format changes come along.

Yet there are still several magic numbers, with not even a hint what they
derive from, like ...

> --- a/libsframe/testsuite/libsframe.find/findfre-1.c
> +++ b/libsframe/testsuite/libsframe.find/findfre-1.c
> @@ -28,9 +28,9 @@
>  #include <dejagnu.h>
>  
>  static int
> -add_fde1 (sframe_encoder_ctx *encode, int idx)
> +add_fde1 (sframe_encoder_ctx *encode, unsigned int start_pc_vaddr,
> +	  unsigned int sframe_vaddr, int idx, unsigned int *func_size)
>  {
> -  int i, err;
>    /* A contiguous block containing 4 FREs.  */
>    sframe_frame_row_entry fres[]
>      = { {0x0, {0x1, 0, 0}, 0x3},
> @@ -38,24 +38,27 @@ add_fde1 (sframe_encoder_ctx *encode, int idx)
>  	{0x10, {0x3, 0xf0, 0}, 0x4},
>  	{0x38, {0x8, 0xf0, 0}, 0x5}
>        };
> +  *func_size = 0x40;

... this one. I can't decide why it's 0x40 here, and it's well possible
the number is simply made up arbitrarily. A brief comment on each of
them may help.

Jan


More information about the Binutils mailing list