www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - Which debugger can explain InvalidMemoryOperationError?

reply Victor Porton <porton narod.ru> writes:
After main() of my program finishes, I have this error message:

core.exception.InvalidMemoryOperationError core/exception.d(700): 
Invalid memory operation

Which debugger (preferably with a GUI interface) do you suggest 
to investigate this error?

I tried DDD and KDbg.

In DDD when I set `catch throw InvalidMemoryOperationError` or 
`catch throw core.exception.InvalidMemoryOperationError`, the 
exception is not called nevertheless.

In KDbg, I don't see any way to set an exception breakpoint, at 
all.

I use LDC2.
Jan 17 2019
next sibling parent reply Alex <sascha.orlov gmail.com> writes:
On Thursday, 17 January 2019 at 16:37:55 UTC, Victor Porton wrote:
 After main() of my program finishes, I have this error message:

 core.exception.InvalidMemoryOperationError core/exception.d(700): Invalid
memory operation

 Which debugger (preferably with a GUI interface) do you suggest 
 to investigate this error?

 I tried DDD and KDbg.

 In DDD when I set `catch throw InvalidMemoryOperationError` or 
 `catch throw core.exception.InvalidMemoryOperationError`, the 
 exception is not called nevertheless.

 In KDbg, I don't see any way to set an exception breakpoint, at 
 all.

 I use LDC2.
Which operating system do you use? And which compiler version? Is this maybe another occurrence of https://github.com/ldc-developers/ldc/issues/2820 ? If so, do you have a usable minimal example of your code to post and try it out?
Jan 17 2019
parent Victor Porton <porton narod.ru> writes:
On Thursday, 17 January 2019 at 20:41:27 UTC, Alex wrote:
 On Thursday, 17 January 2019 at 16:37:55 UTC, Victor Porton 
 wrote:
 After main() of my program finishes, I have this error message:

 core.exception.InvalidMemoryOperationError core/exception.d(700): Invalid
memory operation

 Which debugger (preferably with a GUI interface) do you 
 suggest to investigate this error?

 I tried DDD and KDbg.

 In DDD when I set `catch throw InvalidMemoryOperationError` or 
 `catch throw core.exception.InvalidMemoryOperationError`, the 
 exception is not called nevertheless.

 In KDbg, I don't see any way to set an exception breakpoint, 
 at all.

 I use LDC2.
Which operating system do you use? And which compiler version? Is this maybe another occurrence of https://github.com/ldc-developers/ldc/issues/2820 ? If so, do you have a usable minimal example of your code to post and try it out?
trace. I do not claim that there is a bug in a compiler (actually I am almost sure that it is my mistake and I do something like freeing memory twice). I need help to get a stack trace for the very reason that I do not want to spend time producing a minimal example, but want to use a debugger instead. Ubuntu Linux 18.10. $ ldc2 --version LDC - the LLVM D compiler (1.11.0): based on DMD v2.081.2 and LLVM 6.0.1
Jan 17 2019
prev sibling parent reply Victor Porton <porton narod.ru> writes:
On Thursday, 17 January 2019 at 16:37:55 UTC, Victor Porton wrote:
 After main() of my program finishes, I have this error message:

 core.exception.InvalidMemoryOperationError core/exception.d(700): Invalid
memory operation

 Which debugger (preferably with a GUI interface) do you suggest 
 to investigate this error?

 I tried DDD and KDbg.

 In DDD when I set `catch throw InvalidMemoryOperationError` or 
 `catch throw core.exception.InvalidMemoryOperationError`, the 
 exception is not called nevertheless.

 In KDbg, I don't see any way to set an exception breakpoint, at 
 all.

 I use LDC2.
I've tried it with plain GDB 8.2. The following does not work: catch throw InvalidMemoryOperationError catch throw core.exception.InvalidMemoryOperationError Despite of the above commands, the exception is not caught and so I am unable to see the callstack which has led to the exception. Please help me to find a way to see the callstack in order to be able to debug my software!
Jan 17 2019
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 17/01/2019 23:12, Victor Porton wrote:
 On Thursday, 17 January 2019 at 16:37:55 UTC, Victor Porton wrote:
 After main() of my program finishes, I have this error message:

 core.exception.InvalidMemoryOperationError core/exception.d(700):
 Invalid memory operation

 Which debugger (preferably with a GUI interface) do you suggest to
 investigate this error?

 I tried DDD and KDbg.

 In DDD when I set `catch throw InvalidMemoryOperationError` or `catch
 throw core.exception.InvalidMemoryOperationError`, the exception is
 not called nevertheless.

 In KDbg, I don't see any way to set an exception breakpoint, at all.

 I use LDC2.
I've tried it with plain GDB 8.2. The following does not work: catch throw InvalidMemoryOperationError catch throw core.exception.InvalidMemoryOperationError Despite of the above commands, the exception is not caught and so I am unable to see the callstack which has led to the exception. Please help me to find a way to see the callstack in order to be able to debug my software!
You might want to set a breakpoint on function onInvalidMemoryOperationError. Probably this is the function that is throwing the error. Debugging experience will likely improve if you build the runtime library with debug information. (see https://wiki.dlang.org/Building_under_Posix).
Jan 17 2019
parent kinke <noone nowhere.com> writes:
On Friday, 18 January 2019 at 07:48:21 UTC, Rainer Schuetze wrote:
 Debugging experience will likely improve if you build the 
 runtime library with debug information. (see 
 https://wiki.dlang.org/Building_under_Posix).
He's using LDC, so he'll just need to specify `-link-defaultlib-debug` in the LDC command line.
Jan 18 2019