[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: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Fri, 13 Jun 2008 20:37:09 +0200

Erik Huelsmann wrote:
> On 6/13/08, 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.
>
> On *nix, with gdb, both a segfault and an abort() look very much alike
> and both have the effect of ending up in the debugger as you describe.
> If you have core dumping turned on, you can even -post-mortem- get a
> stack trace to the point of the abort()/assert.

I see, so an abort()/assert() has some value on *nix systems.

>> 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.
>
> Wouldn't it be more usefull for you to - on Windows - force a segfault
> when we in fact really meant an abort/assert()?

That depends. For the main application, yes. Because there I can trap
those and launch our own crash handler which creates a crash dump and
lets the users send that to me by mail.
But for the shell extension, that's not possible. A segfault there will
take down the desktop (as does an abort()). And since that's very bad,
MS has implemented an automatic restart feature for the desktop/explorer
which makes it very difficult to attach a debugger. And since the
explorer/desktop is an MS application, the crash dumps (if they even get
built, depending on the OS settings) get sent directly to MS.

And lets be realistic: most Windows users don't have a debugger
installed, so I have to rely on our own crash report tool to get crash
dumps.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net

Received on 2008-06-13 20:37:28 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.