This is the mail archive of the ecos-discuss@sourceware.org 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]
Other format: [Raw text]

Re: Is it possible to debug assembly code on source level?


>>>>> " " == wang cui <iucgnaw@msn.com> writes:

     > As I debug code by GNU Insight debugger, it works good when
     > debug C/C++ code. But if I steps into assembly code segment, it
     > only shows assembly without any cross information with original
     > assembly source file(like vectors.s, etc.). Althouth I can look
     > over the assembly source outside the debugger and find out what
     > is running. I think it is not convenience(since there are lots
     > of #ifdef in the assembly source). Can't Insight debug on
     > assembly source level?

The debugger can only show information such as the source file and
line number if the ELF executable contains the appropriate debug
information. If you compile some C code with -S -g and look at the
assembler code produced you will see lots of debug-related directives
like .type, .file and .loc. It is these which end up allowing the
debugger to do its work.

For hand-written assembly code the assembler does not generate such
directives automatically. Doing so would be quite hard. Assembler
source code can be an arbitrary mixture of code and data interleaved
in various ways, so the assembler has no easy way of knowing what
debug info it should generate.

Instead if you want source-level debugging of assembler code then you
will need to add the appropriate debug directives into that code. Just
specifying .type on a function entry point seems to be enough to get
the filename into the executable. To get line numbers into the debug
info you will probably need a .debug_line section and .file and .loc
directives, but I do not know the details.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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