discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: best breakpoint for uncaught exceptions


From: David Ayers
Subject: Re: best breakpoint for uncaught exceptions
Date: Fri, 21 Apr 2006 09:09:52 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20051002)

Wolfgang Sourdeau schrieb:
> 
> Actually, it *is* [NSException raise]. When this breakpoint is reached,
> you can ask gdb where it was invoked by requesting a backtrace with
> "bt".

Well the question was qualified with "uncaught exceptions" and a simple
b -[NSException raise]
would catch all exceptions.  But if you read the gdb docs:

(gdb) help breakpoints
Making program stop at certain points.

List of commands:

awatch -- Set a watchpoint for an expression
break -- Set breakpoint at specified line or function
catch -- Set catchpoints to catch events
clear -- Clear breakpoint at specified line or function
commands -- Set commands to be executed when a breakpoint is hit
condition -- Specify breakpoint number N to break only if COND is true
delete -- Delete some breakpoints or auto-display expressions
disable -- Disable some breakpoints
enable -- Enable some breakpoints
hbreak -- Set a hardware assisted  breakpoint
ignore -- Set ignore-count of breakpoint number N to COUNT
rbreak -- Set a breakpoint for all functions matching REGEXP
rwatch -- Set a read watchpoint for an expression
tbreak -- Set a temporary breakpoint
tcatch -- Set temporary catchpoints to catch events
thbreak -- Set a temporary hardware assisted breakpoint
watch -- Set a watchpoint for an expression

Type "help" followed by command name for full documentation.
Command name abbreviations are allowed if unambiguous.

you should notice the "condition" command.  Then you can look at
GNUstep's source on how -raise obtains the current exception handler and
the you can some thing like:

(gdb) start
Breakpoint 1 at 0x8048915: file QuickTest.m, line 8.
...
(gdb) b -[NSException raise]
Breakpoint 2 at 0x405cc2e3: file NSException.m, line 147.
(gdb) condition 2 GSCurrentThread()->_exception_handler==0
(gdb) c

Which should break at -raise for uncaught exceptions only.

Cheers,
David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]