Doh! me bad, I didn't include an example:

The attached .gdbinit loads the symbols from a module, but needs the
start address of the .text section.

        add-symbol-file filename address

address cannot be an expression in gdb5.2, just a simple address
('0x[0-9a-f]+' or '[0-9]+').

Nick


On Tue, 28 May 2002, Mark Peek wrote:

> At 3:54 PM +0200 5/28/02, Nick Hibma wrote:
> >I'm using a derivative of the .gdbinit.vinum files that is available in
> >the modules/vinum directory. For them to work the following patch is
> >needed in gdb52.
> >
> >As you can see, the patch is trivial, so I have no clue why this wasn't
> >left alone when they modified symfile.c. If I can be bothered I'll
> >submit it to them.
> >
> >Nick
> >
> >
> ># diff -wu gdb-5.2/gdb/symfile.c~ gdb-5.2/gdb/symfile.c
> >--- gdb-5.2/gdb/symfile.c~      Tue May 28 15:51:37 2002
> >+++ gdb-5.2/gdb/symfile.c       Tue May 28 15:51:06 2002
> >@@ -1546,11 +1546,15 @@
> >        char *val = sect_opts[i].value;
> >        char *sec = sect_opts[i].name;
> >
> >+#ifdef 0
> >        val = sect_opts[i].value;
> >        if (val[0] == '0' && val[1] == 'x')
> >         addr = strtoul (val+2, NULL, 16);
> >        else
> >         addr = strtoul (val, NULL, 10);
> >+#else
> >+      addr = parse_and_eval_address(val);
> >+#endif
> >
> >        /* Here we store the section offsets in the order they were
> >           entered on the command line. */
>
>
> Nick,
> Could you send me the relevant lines from your .gdbinit that exhibit
> this problem? I'd like to understand why the above patch to gdb is
> necessary.
>
> Thanks!
> Mark
>

-- 
[EMAIL PROTECTED]                  http://www.van-laarhoven.org/
[EMAIL PROTECTED]                        http://www.etla.net/~n_hibma/
define umass
   set $file = linker_files.tqh_first
   set $found = 0
   while ($found == 0 && $file != 0)
     if ($file->filename[0] == 'u' &&$file->filename[1] == 'm' &&$file->filename[2] == 
'a' &&$file->filename[3] == 's' &&$file->filename[4] == 's' &&$file->filename[5] == 
'.' && $file->filename[6] == 'k')
        set $found = 1
     else
       set $file = $file->link.tqe_next
     end
   end

   if ($found == 0)
      echo umass not found in linker_files.\n
   else
      echo file=
      print $file
      shell /usr/bin/objdump --section-headers 
/usr/obj/usr/src-current/sys/HEIDI/modules/usr/src-current/sys/modules/umass/umass.ko.debug
 | grep ' .text' | awk '{print "add-symbol-file 
/usr/obj/usr/src-current/sys/HEIDI/modules/usr/src-current/sys/modules/umass/umass.ko.debug
 \$file->address+0x" $4}' > /tmp/asf.umass
      shell cat /tmp/asf.umass
      source /tmp/asf.umass
      #shell /bin/rm /tmp/asf.umass
   end
end
document umass
   Find the load address of umass in the kernel and add the symbols at this address
end

umass

Reply via email to