This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


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

Re: Debugging information in *.S files


Rosimildo daSilva wrote:
> 
> Do I need to do anything special to get debugging information
> of assembly files ( *.S ) ?
> 
> I have checked for i386-elf toolset and mips-elf, and
> neither one seems to generate the debug info for *.S files.

Well, debug information is contained in the .s assembler files that gcc
generates with -g if that's what you mean.

Or is your question about whether gas can generate debug info for
hand-written assembler files? If so, the answer is no because it wouldn't
make much sense - it's not like there's a high level language it
corresponds with, and it would be nearly impossible for the assembler to
work out even basic stuff, since assembler has so much freedom. You should
just add the necessary directives yourself in your assembler, but it can be
very time-consuming, or in some cases completely intractable by hand.
Compile a C file with "-c -g --save-temps" and look at the .s file and
you'll see what I mean!

But in saying that, one of the most useful and simplest things is to mark
off "functions" in assembler. e.g. if you look in
mips/arch/<VERSION>/include/mips.inc, there are the following macros:

 
#define FUNC_START(name)        \
        .type name,@function;   \
        .globl name;            \
        .ent   name;            \
name:
 
#define FUNC_END(name)          \
name##_end:                     \
        .end name               \

Although this doesn't contain debugging info in the proper sense, if you
use these macros, in the absence of real debug info, GDB will be able to
use the symbol table to let you know which "function" you are in at any
time, if you are single stepping.

Other architectures differ in the pseudos used to do this.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

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