[gdb/symtab] Fix .debug_aranges duplicate offset warning

The function read_addrmap_from_aranges contains code to issue a warning:
...
      if (!insertpair.second)
       {
         warning (_("Section .debug_aranges in %s has duplicate "
                    "debug_info_offset %s, ignoring .debug_aranges."),
                  objfile_name (objfile), sect_offset_str (per_cu->sect_off));
         return false;
       }
...
but the warning is in fact activated when all_comp_units has duplicate
entries, which is very misleading.

Fix this by:
- adding a test-case that should trigger the warning,
- replacing the current implementation of the warning with an
  assert that all_comp_units should not contain duplicates, and
- properly re-implementing the warning, such that it is triggered
  by the test-case.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29381
3 files changed