[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [RFC] Replacement for "assert" in the libraries

From: David Glasser <glasser_at_davidglasser.net>
Date: Fri, 13 Jun 2008 11:19:41 -0700

On Fri, Jun 13, 2008 at 11:10 AM, steveking <tortoisesvn_at_gmail.com> wrote:
> David Glasser wrote:
>
>> I do think that there is value in having a way of assert/aborting from
>> anywhere in the code (not just svn_error_t-returning functions) which
>> can't be ignored accidentally by forgetting to write SVN_ERR and
>> friends. Additionally, assert/abort generally gives good stack traces
>> when run in gdb, whereas it's trickier to track down the source of our
>> error objects.
>
> I don't know how gdb works. I'm just wondering why an assert/abort helps in
> getting a better stacktrace?
> In windows, if an application causes a segfault, the default windows error
> report dialog shows up and if a debugger is installed on the system, it
> gives you the choice to attach the segfaulting process to that debugger. An
> assert (or worse, an abort) doesn't cause a segfault but only shows a
> messagebox with some pretty useless text (something like "the application
> caused the runtime to close unexpectedly") and no chance of attaching a
> debugger.
> So for me, the much better way is still to just segfault instead of
> aborting. Of course, even better: returning an error indicating what exactly
> is wrong.

The problem is that svn_error_t doesn't include a stacktrace (is there
a portable way to do this?) so by the time the error gets to the user,
the PC is no longer anywhere near where the error started. In
maintainer mode the error will at least tell you its file and line
number, so you can set a breakpoint on the svn_error_create, but if
that line creates lots of errors most of which are caught, this will
be a huge pain.

In the paragraph that you didn't quote, though, I suggested a solution
which would let you have whatever handler you want for abort/assert in
your Windows builds.

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-06-13 20:20:05 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.