llothar wrote On 05/30/07 12:23,:
Hello, i'm using Eiffel at the moment for my program.
One of the killer features is a very simple traceback that gives me
after an assert failure the whole stracktrace together with a readable
dump of all local variables and function parameters (normally much
less then 50kb compressed). This can be added to the generated
executable file and so it can run on the clients computer.
Is there any c compiler or library that allows me to do this?
Most C environments include tools to do this sort
of thing. The capabilities, modes of operation, and so
on are specific to the environment and not part of C,
just as the editor you use to prepare C source is not
part of C. You'll need to look at what the plaforms
you care about offer: gdb, pstack, dbx, ...
The amount of information such tools are able to
extract is often influenced by the option flags used to
compile and link the program: There are often specific
"debugging" flags that cause the program to retain a
lot of self-descriptive information that would otherwise
have been discarded, things like information about the
names and types of variables. Usually one can get (at
best) uninterpreted or only semi-interpreted hex dumps
of memory-resident data if debugging flags aren't used.
A further complication is C's tradition of aggressive
optimization. Even with debugging information present
the behavior of a program can seem perverse. For example,
after an `assert (x >= 0)' failure the post-mortem output
might indicate that the value of x is 42 -- so, why did
the assertion fail? It might be that the memory slot
devoted to x is not up-to-date with a transient x being
held in a register; the generated code would have stored
the new (negative) value into x's memory eventually, but
the assert fired first ...
Summary: Traceback facilities (debugging facilities in
general) are system-specific and subject to variation,
compiler and linker options can often improve the quality
of the information they produce, and the information must
be viewed with a dash of caution.
--
Er*********@sun.com