This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dwarf2, DW_CHILDREN_yes/no


Hi,

i just found out that also a gcc generated ELF file with
dwarf2 in it (gcc-3.4.4, binutils-2.16, --target=avr --with-dwarf2)
contains values for DW_CHILDREN higher than 0/1.

The relevant parts of my perl code are attached below.  It won't
work 'as is', because some very lengthy necessary parts are missing.


I wonder how a value different to 0/1 is interpreted?


Best regards,
Torsten.


# set up abbrev table
$ix = 0;
while($ix < length($debug_abbrev)) {
  $abbrev_code = uleb128(\$debug_abbrev, \$ix);
  next if($abbrev_code == 0);

  print "abbrev_code $abbrev_code\n";
  $tag = uleb128(\$debug_abbrev, \$ix);
  $has_children = val_at(\$debug_info, $ix, 1);
  $ix++;
  $tagname = $TAG{$tag};
  $tagname = 'undef' unless(defined($tagname));
  print "tag $tag $tagname children $has_children\n";

  do {
    $attr_name = uleb128(\$debug_abbrev, \$ix);
    $an = $AT{$attr_name};
    $an = 'UNDEF' unless(defined($an));
    $attr_form = uleb128(\$debug_abbrev, \$ix);
    $af = $FORM{$attr_form};
    $af = 'UNDEF' unless defined($af);
    print sprintf("%  02X %02X  %s  %s\n", $attr_name, $attr_form, $an, $af);
  } while($attr_name != 0 or $attr_form != 0);
}


sub uleb128 {
  my ($rs, $ri) = @_;

  my ($stop, $ret, $val, $f);

  $f = 1;
  $ret = 0;
  $stop = 0;

  while(!$stop) {
    $val = ord(substr($$rs, $$ri, 1));
    $$ri++;
    if($val < 0) {
      $val += 0x100;
    }

    if($val & 0x80) {
      $val &= 0x7f;
    }
    else {
      $stop = 1;
    }

    $ret += $f*$val;
    $f *= 128;
  }

  return $ret;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]