Re: [cc65] Debug Information in Objectfiles

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-12-03 12:08:21


Hi!

On Tue, Dec 03, 2002 at 08:39:33AM +0100, Groepaz wrote:
> I was wondering if (and if yes, where :)) there is documentation available
> about the object-file-format used by cc65, specifically about the type of
> debug information used.... (i've just added vice-style labelfiles to my
> debugger and 'real' debuginfo would be the next logical step kinda :o))

There is no documentation available for the object file format used. I do not
even manage to keep up with the standard compiler docs:-) However, it should
not be necessary to access the object files, since all information that is
available in the object files should be collected by the linker and output in
a special debug file. The debug file is currently somewhat incomplete. For
one, it does not include labels that are in the label file. This will get
fixed. Another problem is that the debug file does not contain information
about local symbols. This information is not available in the object file,
since for one, the assembler is not able to handle this information, second,
the compiler does not generate it, and third, it is rather difficult to keep
this information current over the optimizer passes, because the generated code
does not use a base pointer, so the stack offset of locals may change with
every instruction. Because all this is unfinished and not really well tested,
the option for the linker to generate this debug file is undocumented.

        --dbgfile name

is what it needs to get such a debug file.

Being able to step through the C source and watching the values of global
symbols would be tremendously useful, and implementing this is possible using
the currently available information. I would suggest that you generate such a
debug file and have a look at it. It's straight ASCII, and currently it
contains just two types of information:

        file    "crt0.s", 2532, 1038165106

This means that crt0.s is a source file which had 2532 bytes when translated,
and a time stamp of 1038165106 (unix mtime). The additional information can be
used to display a warning in the debugger when the source code available to
the debugger differs from what was available when the object file was
generated.

        line    "em_load.c", 58, 00140B-00142F

This means that the code range starting at 140B (hex) up to and including 142F
(hex) was generated by line 58 of em_load.c. Note that there may be more than
one entry for the same line of source code. An example would be for loops, for
which the compiler generates code on loop entry and exit.

There will be some more line types when more information is added, but the
style will always be the same: The first token on a line is a keyword that
specifies the type of information that follows.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-12-03 12:09:34 CET