This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mdebug




Elena Zannoni <ezannoni@cygnus.com> writes:
>And yes, I have a specific question.  Does mdebug let the user specify
>a procedure like 'main()' in a section other than .text? 

In a section like text, but simply not named '.text'?

( BTW: You don't say, I just take the hint of 'section' in your
question as relating to elf -- arbitrarily :-).

I don't know the answer to your question, 
but I'll mention a few things that might be useful.
Or might simply be repeating what you already know... Sigh.

I presume  by 'text' you mean here  the value printed from a SYMR
structure (local symbols or external symbol), the sc field:

typedef struct __sgi_symr_s {
        long_i  iss;            /* index into String Space of name */
        long_i  value;          /* value of symbol */
        unsigned st : 6;        /* symbol type */
        unsigned sc  : 5;       /* storage class - text, data, etc */
        unsigned reserved : 1;  /* reserved */
        unsigned index : 20;    /* index into sym/aux table */
        } SYMR;
An sc with value scText would print as text or some name like that 
(sgi stdump prints 'text').

(note that EXTR (externals) records have a member SYMR in them, so
they too have these fields)
The set of sc* fields does match sections closely:
In mips/sgi coff the only symbol table was mdebug, so
the linker used the sc* field to decide what section things
belonged to for relocating things (so sc and sections had to match)
(all coff using mdebug had to work this way).
With elf, that strict reliance was gone, as the elf symbols
were the primary linking determiner, though sgi/ld  did
update mdebug because mdebug was the debug information.

(Mdebug has rather a significant amount
of data duplication when used in an elf object.  )
(I'll leave out the war stories to save space in this note :-)

So, IMO, sc should remain scText if the symbol is a function, 
no matter which 'section' it exists in.
You do need to be sure a PDR entry 
(procedure descriptor) gets created for the symbol.

A question (for which I do not have an answer) is
how gnu ld would update the value field for a function
marked scData or something else.
  My quick reading of SGI ld is that ld does not use the
  mdebug data from an elf file as controlling the finding
  of a proper data value: it uses the elf data and later
  updates the value field in mdebug.  
  So the scText in the sc field is not used to determine
  how to update the 'value' field.
  (again, based on a quick reading of some parts of ld,
   not on experimentation.)

Hope this helps (I'm not optimistic there's much in this note
that will help though).
davea@sgi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]