dwarf_loader: Skip empty CUs

Some parts are corrupt, and most are empty CUs, that were causing the
segfault, now pahole doesn't crash and pdwtags, a debug utility that
prints most dwarf tags, produces some output.

  [acme@quaco pahole]$ readelf -wi examples/asm/dw2-error.debug  | grep -i corrupt
  readelf: examples/asm/dw2-error.debug: Warning: Invalid pointer size (0) in compunit header, using 4 instead
  readelf: examples/asm/dw2-error.debug: Warning: CU at offset 90 contains corrupt or unsupported version number: 153.
  [acme@quaco pahole]$ pahole examples/asm/dw2-error.debug
  [acme@quaco pahole]$ pdwtags examples/asm/dw2-error.debug
  /* Types: */

  /* Functions: */

  /* Variables: */

  /* Types: */

  /* 1 */
  int
   /* size: 4 */

  /* 2 */
  /* tag__fprintf: const_type tag not supported! */; /* size: 4 */

  /* Functions: */

  /* Variables: */

  const int                  _IO_stdin_used; /* size: 4 */

  /* Types: */

  /* Functions: */

  /* Variables: */

  [acme@quaco pahole]$

Reported-by: Tom de Vries
Bugtracker: https://github.com/acmel/dwarves/issues/9#issuecomment-696284602
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed