Hi,

The following small patch to 4.6.2:

--- sys/sys/linker.h.orig       Tue Nov 19 20:05:29 2002
+++ sys/sys/linker.h    Tue Nov 19 11:24:30 2002
@@ -94,6 +94,7 @@
     int                        id;             /* unique id */
     caddr_t            address;        /* load address */
     size_t             size;           /* size of file */
+    size_t              text_offs;      /* Location of text */
     int                        ndeps;          /* number of dependancies 
*/
     linker_file_t*     deps;           /* list of dependancies */
     STAILQ_HEAD(, common_symbol) common; /* list of common symbols */
--- sys/kern/link_elf.c.orig    Tue Nov 19 20:08:32 2002
+++ sys/kern/link_elf.c Tue Nov 19 17:59:16 2002
@@ -611,6 +611,7 @@
     }
     lf->address = ef->address;
     lf->size = mapsize;
+    lf->text_offs = hdr->e_entry;;
 
     error = parse_dynamic(lf);
     if (error)

Would allow the following sort of gdb script file:

define load-ko-syms
   path ./freebsd_46_i386/debug/export/kernel
   set $file = linker_files.tqh_first
   set $file = $file->link.tqe_next
   if ($file == 0)
        printf "No klds to load symbols for\n"
   else
        while ($file != 0)
                add-symbol-file $file->filename ($file->address + 
$file->text_offs)
                printf "Loaded symbols for %s\n", $file->filename
                set $file = $file->link.tqe_next
        end
   end
end

Of course, you will need a recent version of GDB.

-- 
Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com
--- sys/sys/linker.h.orig       Tue Nov 19 20:05:29 2002
+++ sys/sys/linker.h    Tue Nov 19 11:24:30 2002
@@ -94,6 +94,7 @@
     int                        id;             /* unique id */
     caddr_t            address;        /* load address */
     size_t             size;           /* size of file */
+    size_t              text_offs;      /* Location of text */
     int                        ndeps;          /* number of dependancies */
     linker_file_t*     deps;           /* list of dependancies */
     STAILQ_HEAD(, common_symbol) common; /* list of common symbols */
--- sys/kern/link_elf.c.orig    Tue Nov 19 20:08:32 2002
+++ sys/kern/link_elf.c Tue Nov 19 17:59:16 2002
@@ -611,6 +611,7 @@
     }
     lf->address = ef->address;
     lf->size = mapsize;
+    lf->text_offs = hdr->e_entry;;
 
     error = parse_dynamic(lf);
     if (error)

Reply via email to