]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Refine range check in create_addrmap_from_gdb_index
authorTom Tromey <tromey@adacore.com>
Wed, 13 Aug 2025 16:16:46 +0000 (10:16 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 13 Aug 2025 20:36:04 +0000 (14:36 -0600)
commit421c4a00d9e2bdfffe9817600c4b4abb39464a3f
tree29bfb096dd5f9023efa791a640aa586fc5790201
parent73dcc5e15bad199afc9154af04c1ac4e7b486620
Refine range check in create_addrmap_from_gdb_index

PR symtab/33247 points out that this check in
create_addrmap_from_gdb_index:

      if (lo > hi)
{
  complaint (_(".gdb_index address table has invalid range (%s - %s)"),
     hex_string (lo), hex_string (hi));

... should probably use ">=" instead.  Reading a bit further the
reason seems obvious:

      mutable_map.set_empty (lo, hi - 1, index->units[cu_index]);

Here if lo==hi, then this will insert a "reversed" range into the
addrmap.

Apparently some LLVM tool can erroneously create a .gdb_index like
this.

No test because it seems like more trouble to write than it's worth.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33247
Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/dwarf2/read-gdb-index.c