[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom [Joel Vallier <vallier@col.bsf.alcatel.fr>] (fwd)



>From owner-rtl Fri Jun 22 01:32:58 2001
Received: from mel.alcatel.fr (mel.alcatel.fr [212.208.74.132])
	by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f5M7Wre12905
	for <rtl@fsmlabs.com>; Fri, 22 Jun 2001 01:32:54 -0600
Received: from aifhs2.alcatel.fr (mailhub.alcatel.fr [155.132.180.80])
        by mel.alcatel.fr (ALCANET/SMTP) with ESMTP id IAA18777
        for <rtl@fsmlabs.com>; Fri, 22 Jun 2001 08:03:08 +0200
Received: from bsf.alcatel.fr (mail.dit.sxb.bsf.alcatel.fr [155.132.20.1])
        by aifhs2.alcatel.fr (ALCANET/SMTP2) with ESMTP id JAA16555
        for <rtl@fsmlabs.com>; Fri, 22 Jun 2001 09:25:59 +0200 (MET DST)
Received: from cabsimp1 (cabsimp1 [155.132.46.160])
	by bsf.alcatel.fr (8.8.8+Sun/8.9.3) with SMTP id JAA26922
	for <rtl@fsmlabs.com>; Fri, 22 Jun 2001 09:25:07 +0200 (MET DST)
Received: from cdar14.clb by cabsimp1 (SMI-8.6/SMI-4.1)
	id JAA02503; Fri, 22 Jun 2001 09:24:55 +0200
Received: from col.bsf.alcatel.fr (localhost [127.0.0.1])
	by cdar14.clb (8.9.3+Sun/8.9.3) with ESMTP id JAA02352;
	Fri, 22 Jun 2001 09:24:55 +0200 (MEST)
Sender: vallier@cdar14.clb
Message-ID: <3B32F2C4.4269F85C@col.bsf.alcatel.fr>
Date: Fri, 22 Jun 2001 09:24:52 +0200
From: Joel Vallier <vallier@col.bsf.alcatel.fr>
X-Mailer: Mozilla 4.7 [en] (X11; I; SunOS 5.8 sun4u)
X-Accept-Language: fr, en
MIME-Version: 1.0
To: rtl@fsmlabs.com, Joel Vallier <vallier@cdar14.clb>
Subject: Re: [rtl] Re: regd RTL debugger
References: <20010621143416.A4238@fsmlabs.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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  <ezannoni@kwikemart.cygnus.com>

        * 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  <ezannoni@kwikemart.cygnus.com>

        * 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 owner-rtl@fsmlabs.com -----