www.digitalmars.com         C & C++   DMDScript  

D - Function names with call stacks

reply "Nathan Matthews" <nedthefed nospam.hotmail.com> writes:
One aspect of Java I like is on an exception you can print the stack trace,
C++ give no easy way of doing that, Function address to function name
mappings are not stored, you can build this in and do some hacking to get
round it but its inelegant and non-portable.  It surely wouldnt be hard to
do this functionality in D, at the very least it would be good to include a
mechanism to get the call stack with a set of arguments.
Aug 28 2001
next sibling parent reply "Walter" <walter digitalmars.com> writes:
Good debuggers can do that even with C++ programs. I don't think it's a
language design issue, but a debugger support issue. Stack traces are
important, and I intend to make the D implementation work with debuggers to
provide it. -Walter

Nathan Matthews wrote in message <9mftle$134h$1 digitaldaemon.com>...
One aspect of Java I like is on an exception you can print the stack trace,
C++ give no easy way of doing that, Function address to function name
mappings are not stored, you can build this in and do some hacking to get
round it but its inelegant and non-portable.  It surely wouldnt be hard to
do this functionality in D, at the very least it would be good to include a
mechanism to get the call stack with a set of arguments.
Aug 28 2001
parent reply Dan Hursh <hursh infonet.isl.net> writes:
	I think the thought here was Java's ability to take an exception and
print (at runtime) the stack when the exception occurred.  I think java
automatically shows the exception stack for uncaught exceptions.  (It
might be how our environment is setup at work.)  I don't know if you
want to keep that much symbolic information in the executables.  Maybe
it's already there too. 

Dan

Walter wrote:
 
 Good debuggers can do that even with C++ programs. I don't think it's a
 language design issue, but a debugger support issue. Stack traces are
 important, and I intend to make the D implementation work with debuggers to
 provide it. -Walter
 
 Nathan Matthews wrote in message <9mftle$134h$1 digitaldaemon.com>...
One aspect of Java I like is on an exception you can print the stack trace,
C++ give no easy way of doing that, Function address to function name
mappings are not stored, you can build this in and do some hacking to get
round it but its inelegant and non-portable.  It surely wouldnt be hard to
do this functionality in D, at the very least it would be good to include a
mechanism to get the call stack with a set of arguments.
Aug 29 2001
parent Eric Gerlach <egerlach canada.com> writes:
  I think the thought here was Java's ability to take an exception and
 print (at runtime) the stack when the exception occurred.  I think java
 automatically shows the exception stack for uncaught exceptions.
Yes it does. Also, the Throwable object has methods called getCallStack() and printCallStack() (I think that's what they're called)
Aug 30 2001
prev sibling parent "Richard Krehbiel" <rich kastle.com> writes:
"Nathan Matthews" <nedthefed nospam.hotmail.com> wrote in message
news:9mftle$134h$1 digitaldaemon.com...
 One aspect of Java I like is on an exception you can print the stack
trace,
 C++ give no easy way of doing that, Function address to function name
 mappings are not stored, you can build this in and do some hacking to get
 round it but its inelegant and non-portable.  It surely wouldnt be hard to
 do this functionality in D, at the very least it would be good to include
a
 mechanism to get the call stack with a set of arguments.
To print a stack trace at run time would require the names of all functions to be stored with the executable, and I, for one, do *not* wish for the full program symbol table to be a run-time requirement. If you really need that, by golly, you've got Java, go use it. To write a binary image of a stack trace to some external location so that a symbolic debugger could examine it, well, now that feature might have merit. Oh, wait; I just described a core dump. :-) (Loosely related: I've read about Windows NT support for core dumps, and though I tried to make it work once, I failed. If you want a deliriously happy camper over here, give me a language system which makes core dumps work with Win32 executables on NT.) -- Richard Krehbiel, Arlington, VA, USA rich kastle.com (work) or krehbiel3 home.com (personal)
Aug 30 2001