Crash handler with stack trace

Tom S h3r3tic at remove.mat.uni.torun.pl
Sun Sep 20 21:31:20 PDT 2009


Jeremie Pelletier wrote:
> Tom S Wrote:
> 
>> Jeremie Pelletier wrote:
>>> I've been asked for my runtime crash handler with it's CodeView reader earlier in digitalmars.D so here it is:
>>>
>>> http://jump.fm/UVYHG
>>>
>>> It includes the runtime handler, a PE reader, CodeView reader and crash report window.
>>>
>>> So far it supports Windows and some bits are already done for posix platforms. It does a register dump, stack trace with resolved symbol names with their declaration file and line, as well as a listing of all loaded modules.
>>>
>>> Sorry for the lack of phobos/tango support, this is part of a runtime project I'm building which should hopefully be released to dsource in a few months. I'm releasing it now so if someone wants to implement a phobos or tango port they're free to do it.
>> Thanks a lot, Jeremie! The code looks really good. I think I'll be 
>> stealing the PE && CV parsing parts for Tango :)
> 
> I'm glad to hear that! Just keep my name in the credits and I'll be happy :)

Sure thing, I generally stick to the same philosophy :)


>> I'm curious about the runtime project of yours :o Can you shed a bit of 
>> the secret? How will it compare to druntime? What's the target audience? 
>> Does it have anything to do with 'meshes and textures'? ;)
> 
> Well it started a bit over two years ago, back then there was no druntime, I was digging into phobos to learn more about the language and decided it would be a fun and challenging task to write my own runtime. Then once I had it running stable I found out druntime had been created in the meantime!
> 
> In any ways, I learned quite a bit of the language's internals and ABI while coding and debugging it; I began by removing all default paths and libraries from dmd (both in sc.ini and compiling with "--defaultlib= --debuglib=--") and made an empty object.d and built my way up until there was no more compiler crashes (dmd is quite whiny about not having its "intrinsic" symbols declared, mostly the typeinfo's) and all unresolved symbols were added.
> 
> Since then the runtime was ported to D2 and kept up to date with every new release, I've been using it for these two years and it works great.
> 
> I don't really know how it will compare to druntime, I'm not out there to compete with them really. I use DMD on both windows and posix platforms (Win7 and Ubuntu respectively) so its the only supported compiler right now, haven't tested 64-bit support either. It would be able to support libraries such as phobos and tango with a few changes to the places that call into the compiler runtime or memory manager.

Thanks for the in-depth background story! Looks like you went a similar 
route that folks trying to do kernels in D choose. Perhaps if you had 
mentioned the development of this runtime earlier, druntime could be a 
joint project... But maybe it's not too late and druntime could still 
benefit from your expertise? There are scarcely few guys who understand 
the guts of writing D runtimes - I could probably count them all on the 
fingers of one palm ;) And I don't necessarily mean the concrete 
implementations but also the top-level structure.


> Right now the target audience is me. I haven't really considered who the target audience might be since I touch a bit of everything. I try and make it as generic and as modular as I can, so if someone doesn't need a package they can remove it from their build without getting tons of compile errors. I myself am focusing towards GUI application development with unified 2D/3D rendering and custom controls on top of that rendering as part of the runtime library, among many other things.

So it's floor wax *and* dessert topping? Sounds like you're set on doing 
  _everything_ from scratch :o I don't think nowadays I'd be willing to 
live without Tango's streams...


> So you could say it has to do with meshes and textures, although I haven't gotten to making interfaces for that part yet. The most I did on that level with my runtime was to write a reader for Blizzard's MPQ archives and extract model and texture data to render it in opengl, but apart from the MPQ reader it was all pretty ugly mixing win32 and gl code along with other stuff in the same routine to get the model on screen as fast as possible ;)

Haha, well that's a noble goal. I'll have to get myself some readers for 
  third-party formats as well. In retrospect, writing a custom 3ds max 
exporter and supporting only it was a bad idea :P


> I really am just beginning to notice people are interested in my project, I don't know when I'll put it on dsource and/or sourceforge. And given that D2 is still under heavy development it wouldn't be practical right now. I don't mind releasing bits and pieces of it but I would much rather see the first public release of it to be an usable one, although the compiler implementation part is pretty much stable at this point, if there's enough demand for it I might begin with that.

I'm sure people would become interested way earlier, had you mentioned 
the project anywhere :P I'm still in D1 land, but there are folks trying 
to use D2 and craving for some code to look into and build upon. The 
more code we release to the general public, the bigger D feels like and 
the greater chances it has of attracting new users... at least that's 
what I like to believe :P


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode


More information about the Digitalmars-d-announce mailing list