[committed][gdb/symtab] Make find_block_in_blockvector more robust

Simon Marchi simark@simark.ca
Thu Oct 22 21:42:01 GMT 2020


On 2020-10-22 5:21 p.m., Tom de Vries wrote:
> On 10/22/20 8:56 PM, Tom Tromey wrote:
>>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>>
>> Tom> +      if (!(BLOCK_START (b) <= pc))
>> Tom> +	return NULL;
>>
>> This seems a bit weird to me, in that if BLOCK_START(b) == pc, then I
>> would be inclined to say that the pc is in fact in that block.
>>
>
> So if BLOCK_START(b) == pc, indeed the pc is in the block, and we have:
> ...
>       if (!(true))
> 	return NULL;
> ...
> which I'd say correctly handles that case.
>
> Thanks,
> - Tom
>

I think that turning:

  if (!(BLOCK_START (b) <= pc))

into

  if (BLOCK_START (b) > pc)

or

  if (pc < BLOCK_START (b))

would make it easier to read.

Simon


More information about the Gdb-patches mailing list