www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Temporary suggestion for assert

reply Ant <duitoolkit yahoo.ca> writes:
until the assert can print out more usefull information can we have
the program exit with something gdb can catch so we can print a
backtrace?

look out I'm doing:
	String insert(String string, int pos)
	in
	{
		if ( (pos < 0) || (pos >= length) )
		{
			printf("String.insert pos=%d, length=%d\n", pos, length);
			String s; s.split();
		}
	}
	body

:p

Ant
Apr 21 2005
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Ant wrote:

 until the assert can print out more usefull information can we have
 the program exit with something gdb can catch so we can print a
 backtrace?

See http://www.digitalmars.com/techtips/unittests.html ? But I think Walter said that filename and linenumber is all that is needed, and the reason why assert doesn't allow a message to be attached to it: assert(exp,"why"); --anders
Apr 22 2005
parent Ant <duitoolkit yahoo.ca> writes:
Anders F Björklund wrote:
 Ant wrote:
 
 until the assert can print out more usefull information can we have
 the program exit with something gdb can catch so we can print a
 backtrace?

See http://www.digitalmars.com/techtips/unittests.html ?

Thanks, I guess I can do with that! Ant
Apr 22 2005
prev sibling parent Sean Kelly <sean f4.ca> writes:
In article <d49qqh$1dd5$1 digitaldaemon.com>, Ant says...
until the assert can print out more usefull information can we have
the program exit with something gdb can catch so we can print a
backtrace?

Why not put: asm int 3; in the assert handler. Sean
Apr 23 2005