1

objdump を使用してアセンブリ コード (ソース コードと混合) を生成しようとすると、

gcc -g -c test.c ;
objdump -S -M intel test.o > out.asm

次のエラーが表示されます。

BFD: Dwarf Error: mangled line number section.

生成された出力アセンブリは、ソース コードと混在していません。誰かがこれが何を意味するのかを明確にすることができますか? とにかくこれを修正する方法はありますか?

4

2 に答える 2

2

「objdump-S-M」は、.oファイルの「.debug_abbrevsection」セクションを予期しているようですが、「gcc-g」は明らかにそれを書き込んでいません。

私はそれについてあなたができることは何もないと思います(あなたはすでにデバッグシンボルを含めるために「-g」を使用しています)。そして、無視するのは完全に安全だと思います。

問題のあるパッケージは「binutils」です。完全なコードは次のとおりです。

http://opensource.apple.com/source/binutils/binutils-20/src/bfd/dwarf2.c

/* In DWARF version 2, the description of the debugging information is
   stored in a separate .debug_abbrev section.  Before we read any
   dies from a section we read in all abbreviations and install them
   in a hash table.  */

static struct abbrev_info**
read_abbrevs (abfd, offset)
     bfd * abfd;
     unsigned int offset;
{
  struct abbrev_info **abbrevs;
  char *abbrev_ptr;
  struct abbrev_info *cur_abbrev;
  unsigned int abbrev_number, bytes_read, abbrev_name;
  unsigned int abbrev_form, hash_number;
  struct dwarf2_debug *stash;

  stash = elf_tdata(abfd)->dwarf2_find_line_info;

  if (! stash->dwarf_abbrev_buffer)
    {
      asection *msec;

      msec = bfd_get_section_by_name (abfd, ".debug_abbrev");
      if (! msec)
    {
      (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_abbrev section."));
      bfd_set_error (bfd_error_bad_value);
      return 0;
    }
于 2012-11-28T20:40:58.607 に答える