Michael Barabanov wrote:
> 
> >  whether it is possible to use one module rtl_debug.o to debug different modules
> >  separately used by two people, i faced probelm while doing this.
> 
> No, it's not possible. There's no concept of ownership of RTLinux
> threads; only root can create them anyway.
> 
> > i am unable to set or print the varianbles some times  via gdb ( just command line 
>, not using GDB)
> > like the context is as follws
> >  1) global variables of a file( assume here i am having only one file) in a module
> 
> Probably a bug in gdb. Try explicitely initializing your global variables,
> for example to 0.
> 
Hi,

Modules must be compiled with the "-fno-common" option. Else, GDB 
won't find informations concerning global uninitialized variables. 
Moreover, this option prevent multiple global data definition.

Standard GDB 5.0 failed to locate global variables when we load 
modules with add-symbol-file command. Indeed, it takes the ".text" 
section offset to compute address of global initialized variables 
instead of using the offset of ".data" section.

To fix this problem we have to path GDB (see below).

This patch is a concatenation of 2 patchs from the mailing list at 
http://sourceware.cygnus.com/gdb:

        2000-05-04  Elena Zannoni  <[EMAIL PROTECTED]>

        * elfread.c (elf_symtab_read): The calculation of 'offset'
        must be done for each symbol, not just once. The index
        used must be the index of the section where 'sym' resides,
        not .text.

        2000-05-09  Elena Zannoni  <[EMAIL PROTECTED]>

        * elfread.c (record_minimal_symbol_and_info): Use the section 
        where the symbol lives to get the index, instead of guessing.

Joel

Note: You need to compile your module without -fomit-frame-pointer 
      as Michael said.

----------------------------------
Here is the patch:

diff -Nru gdb-5.0/gdb/elfread.c gdb-5.0-patch/gdb/elfread.c
--- gdb-5.0/gdb/elfread.c       Tue Feb 15 05:48:23 2000
+++ gdb-5.0-patch/gdb/elfread.c Mon Nov 13 09:19:00 2000
@@ -191,18 +191,16 @@
     {
     case mst_text:
     case mst_file_text:
-      section = SECT_OFF_TEXT;
+      section = bfd_section->index;
 #ifdef SMASH_TEXT_ADDRESS
       SMASH_TEXT_ADDRESS (address);
 #endif
       break;
     case mst_data:
     case mst_file_data:
-      section = SECT_OFF_DATA;
-      break;
     case mst_bss:
     case mst_file_bss:
-      section = SECT_OFF_BSS;
+      section = bfd_section->index;
       break;
     default:
       section = -1;
@@ -293,8 +291,7 @@
       if (number_of_symbols < 0)
        error ("Can't read symbols from %s: %s", bfd_get_filename (objfile->obfd),
               bfd_errmsg (bfd_get_error ()));
-      /* FIXME: Should use section specific offset, not SECT_OFF_TEXT. */
-      offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+
       for (i = 0; i < number_of_symbols; i++)
        {
          sym = symbol_table[i];
@@ -305,6 +302,7 @@
              continue;
            }
 
+         offset = ANOFFSET (objfile->section_offsets, sym->section->index);
          if (dynamic
              && sym->section == &bfd_und_section
              && (sym->flags & BSF_FUNCTION))

----- End of forwarded message from [EMAIL PROTECTED] -----
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to