how can i have retrieve this kind of info with delphi?
...
You probably can't.
There *must* be something, as I clearly remember Delphi-generated programs returning such details in their error messages. And without any shamanistic dances like this one. I just don't know how. But it should be there. Try searching the delphi-specific forums.

Chebmasters code probably utilises gdb or dwarf information which currently only fpc generates AFAIK(!!)
That's true, it uses part of the dwarf information (the line info).

I just took two modules from FreePascal RTL - they were there, they just didn't work. I modified them some and added my own code for DLL support.

The lnfodwrf.pp had an almost working dwarf line info parser and ELF extractor, the lineinfo.pp had a working PE extractor (but tried to search for the old debugging info format that FPC doesn't generate anymore)

By the way, there are limitations. The line info is generated and stored per unit, so it would be available only for those units compiled with the -gw key.
The standard RTL units don't have such info.
So, if exception is raised in one of the standard classes (for example, you try to create a stream with invalid file name) - you'll get "no debug info is available for this address".

On the plus side, it does *always* find the executable name, be it your own exe or kernel32.dll - that's the power of VirtualQuery() (win32) and dladdr() (unix)

Thus, it can retrieve the line info even for a dll compiled in c - if it has that info.