Hello,

In gdb-5.0 (--host=sparc-sun-solaris2.5.1 --target=i386-linux-gnu), the
command 'add-symbol-file' does not work correctly with ELF objects:
all symbols are relocated to .text (I'm using the -T option).

I found the problem in gdb/elfread.c, and I tried to fix it. It seems
to work for me while debugging linux kernel modules, but I'm not sure it
will work in any cases. Here is the patch:

---------------->8------------------
--- gdb-5.0/gdb/elfread.c.orig  Tue Feb 15 05:48:23 2000
+++ gdb-5.0/gdb/elfread.c       Wed Jun 28 10:14:19 2000
@@ -293,8 +293,10 @@
       if (number_of_symbols < 0)
        error ("Can't read symbols from %s: %s", bfd_get_filename (objfile->obfd),
               bfd_errmsg (bfd_get_error ()));
+#if 0 /*JFM*/
       /* FIXME: Should use section specific offset, not SECT_OFF_TEXT. */
       offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+#endif
       for (i = 0; i < number_of_symbols; i++)
        {
          sym = symbol_table[i];
@@ -305,6 +307,9 @@
              continue;
            }
 
+#if 1 /*JFM*/
+       offset = ANOFFSET (objfile->section_offsets, sym->section->index);
+#endif
          if (dynamic
              && sym->section == &bfd_und_section
              && (sym->flags & BSF_FUNCTION))
---------------->8------------------

-- 
Ken ar c'hentań         ** Breizh ha Linux atav ! **
                mailto:[EMAIL PROTECTED]
Jef             (home mailto:[EMAIL PROTECTED])
                http://moinejf.free.fr/



Reply via email to