Thread overview | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 06, 2010 D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
I wrote a small piece of sourcecode that generates stacktraces in D 2.0 under windows. It works both with the pdb and cv debug symbol format. For Exceptions that are derived from the Error class the trace information is automatically appended, this causes all builtin D errors to get a stacktrace information. The only point where this does not work is the Access Vioaltion error, as it does not call the stacktrace callback function for some reason. It is very easy to use, just copy the two files from the zip archive to your root source directory and import the stacktrace module inside your main file. For more informaiton and the download go to: http://3d.benjamin-thaut.de Let me know what you think. Kind Regards Benjamin Thaut |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | Thanks that is pretty cool !
On 06.10.2010 13:50, Benjamin Thaut wrote:
> I wrote a small piece of sourcecode that generates stacktraces in D 2.0 under
> windows. It works both with the pdb and cv debug symbol format. For Exceptions
> that are derived from the Error class the trace information is automatically
> appended, this causes all builtin D errors to get a stacktrace information.
> The only point where this does not work is the Access Vioaltion error, as it
> does not call the stacktrace callback function for some reason.
>
> It is very easy to use, just copy the two files from the zip archive to your
> root source directory and import the stacktrace module inside your main file.
> For more informaiton and the download go to:
> http://3d.benjamin-thaut.de
>
> Let me know what you think.
>
> Kind Regards
> Benjamin Thaut
|
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | I found a thread about the missing access violations: http://www.digitalmars.com/d/archives/digitalmars/D/TraceHandler_not_being_called_on_Access_violation_112557.html#N112580 did you issue a bug report or was there any progress on this, i mean the thread is kinda old. On 06.10.2010 13:50, Benjamin Thaut wrote: > I wrote a small piece of sourcecode that generates stacktraces in D 2.0 under > windows. It works both with the pdb and cv debug symbol format. For Exceptions > that are derived from the Error class the trace information is automatically > appended, this causes all builtin D errors to get a stacktrace information. > The only point where this does not work is the Access Vioaltion error, as it > does not call the stacktrace callback function for some reason. > > It is very easy to use, just copy the two files from the zip archive to your > root source directory and import the stacktrace module inside your main file. > For more informaiton and the download go to: > http://3d.benjamin-thaut.de > > Let me know what you think. > > Kind Regards > Benjamin Thaut |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan | That thread is from me. I did not issue a bug report yet, but I posted a question if there was any progress on this issue. Kind Regards Benjamin Thaut |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | Hi Benjamin. I've tried your stacktrace code, with DMD v2.049, on Windows XP. But I hit two issues: 1. When compiling with -w (warnings) I get this error on your code: > C:\dmd\src\stacktrace.d(218): Warning: overrides base class function object.Object.toString, but is not marked with 'override' Compiles either adding the override keyword, or without using the -w switch. 2. With this simple program: --- import stacktrace; void main( string[] args ) { throw new Exception("Test"); } --- I get the following in the command line: > object.Exception: Test > ---------------- > 00 4683480 > 01 4683543 > 02 4683233 > 03 4887305 > 04 RegisterWaitForInputIdle I just get a bunch of (I presume) addresses, but no names for the methods in the stack trace chain. I don't know if there something wrong with my setup, or maybe something is interfering with the stack trace printing. Any thoughts? -- Yao G. |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yao G. | You have to compile with the -g option so that dmd produces debugging symbols. Without symbols you will get just the addresses in your callstack. Didn't check for warnings, will fix that. Kind Regards Benjamin Thaut |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On Wed, 06 Oct 2010 14:31:26 -0500, Benjamin Thaut <code@benjamin-thaut.de> wrote: > You have to compile with the -g option so that dmd produces debugging symbols. > Without symbols you will get just the addresses in your callstack. Didn't check > for warnings, will fix that. > > Kind Regards > Benjamin Thaut Yes. I'm compiling with the -g switch. -- Yao G. |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | I forgot to mention. I'm compiling the file using: > dmd test.d C:\dmd\src\stacktrace.d C:\dmd\src\dbghelp.d -g -w -- Yao G. |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yao G. | Exactly the same code and the same compiler options give the following results for me: object.Exception: Test ---------------- 00 extern (C) int rt.dmain2.main(int, char**) . void runMain() . 01 extern (C) int rt.dmain2.main(int, char**) . void runAll() . 02 main 03 mainCRTStartup 04 BaseThreadInitThunk 05 RtlInitializeExceptionChain 06 RtlInitializeExceptionChain Can you please check which version of dbghelp.dll is installed on your system? Which exact version of XP do you use? (service pack, x86/x64)? Kind Regards Benjamin Thaut |
October 06, 2010 Re: D 2.0 Stacktrace | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On Wed, 06 Oct 2010 15:22:18 -0500, Benjamin Thaut <code@benjamin-thaut.de> wrote: > Can you please check which version of dbghelp.dll is installed on your system? The version in the WINDOWS\System32\folder is 5.1.2600.5512. > Which exact version of XP do you use? (service pack, x86/x64)? Windows XP Pro Service Pack 3. x86 I think that some process is hooked and interfering with the debugging facilities. Since I installed the Visual Studio 2008 Shell, whenever a program crashes, the VS Debugger automatically fires up and ask me to allow it to debug or disassemble the core dump. Maybe is something related to that. -- Yao G. |
Copyright © 1999-2021 by the D Language Foundation