<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MATLAB Basics: Using dbstop if error</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-13089</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 16 Mar 2009 13:14:33 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-13089</guid>
		<description>Eric,

We make it a policy not to comment about upcoming features, but I can say this suggestion was of interest.  Sorry for not being able to say anything more.

-Doug</description>
		<content:encoded><![CDATA[<p>Eric,</p>
<p>We make it a policy not to comment about upcoming features, but I can say this suggestion was of interest.  Sorry for not being able to say anything more.</p>
<p>-Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric S</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-13086</link>
		<dc:creator>Eric S</dc:creator>
		<pubDate>Fri, 13 Mar 2009 16:09:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-13086</guid>
		<description>Doug, 
did you get any comments from the development team regarding  the &quot;dbstop in mfile&quot; suggestion by Morrison? I think in particular it would make sense to break in the stack frame of on of the mfile indicated. If the error is not in the developer&#039;s code but somewhere hidden by the intricacies of one of the internal/supplied/toolbox function, then this leaves the option to dbdown to the bottom of the stack. On average, this would save a lot of stack frame leveling. 

There could be a small button in the editor saying &quot;dbstop in all open mfiles&quot;, and &quot;dbstop at error&quot;. 
Oh yes, a mfile to specify when pressing f5 (so that you don&#039;t have to switch back and forth between windows for debugging) would be nice, too.

...dreaming, 

Eric</description>
		<content:encoded><![CDATA[<p>Doug,<br />
did you get any comments from the development team regarding  the &#8220;dbstop in mfile&#8221; suggestion by Morrison? I think in particular it would make sense to break in the stack frame of on of the mfile indicated. If the error is not in the developer&#8217;s code but somewhere hidden by the intricacies of one of the internal/supplied/toolbox function, then this leaves the option to dbdown to the bottom of the stack. On average, this would save a lot of stack frame leveling. </p>
<p>There could be a small button in the editor saying &#8220;dbstop in all open mfiles&#8221;, and &#8220;dbstop at error&#8221;.<br />
Oh yes, a mfile to specify when pressing f5 (so that you don&#8217;t have to switch back and forth between windows for debugging) would be nice, too.</p>
<p>&#8230;dreaming, </p>
<p>Eric</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron D. Marasco</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12961</link>
		<dc:creator>Aaron D. Marasco</dc:creator>
		<pubDate>Thu, 11 Dec 2008 21:03:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12961</guid>
		<description>Yes, I am aware of conditionals, but if you &quot;clear all&quot; they go away with your variables, and same with quitting your session. The solution I came up with uses the &quot;keyboard&quot; command that I wasn&#039;t aware of that support told me about (it&#039;s in &quot;doc dbstop&quot; but not &quot;help dbstop&quot;). 

Anyway, here&#039;s what I do now:
% In init section at top
debug=1;

% Later...
if debug &amp;&amp; ~isequal(input, expected_input), keyboard; end;

That drops me into the debugger the same way (with F5 continuing the code). However, if I am sick of it, I can just type &quot;debug=0&quot; and then F5/dbcont will let it continue past it.</description>
		<content:encoded><![CDATA[<p>Yes, I am aware of conditionals, but if you &#8220;clear all&#8221; they go away with your variables, and same with quitting your session. The solution I came up with uses the &#8220;keyboard&#8221; command that I wasn&#8217;t aware of that support told me about (it&#8217;s in &#8220;doc dbstop&#8221; but not &#8220;help dbstop&#8221;). </p>
<p>Anyway, here&#8217;s what I do now:<br />
% In init section at top<br />
debug=1;</p>
<p>% Later&#8230;<br />
if debug &amp;&amp; ~isequal(input, expected_input), keyboard; end;</p>
<p>That drops me into the debugger the same way (with F5 continuing the code). However, if I am sick of it, I can just type &#8220;debug=0&#8243; and then F5/dbcont will let it continue past it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12960</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Thu, 11 Dec 2008 15:27:47 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12960</guid>
		<description>Aaron,

I take it that you already know about conditional breakpoints that can be added by clicking on the breakpoint in the editor?

Thanks for the idea,
Doug</description>
		<content:encoded><![CDATA[<p>Aaron,</p>
<p>I take it that you already know about conditional breakpoints that can be added by clicking on the breakpoint in the editor?</p>
<p>Thanks for the idea,<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron D. Marasco</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12956</link>
		<dc:creator>Aaron D. Marasco</dc:creator>
		<pubDate>Wed, 10 Dec 2008 14:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12956</guid>
		<description>Came here on a Google search... what I want (and am submitting an enhancement request for) is a &quot;dbstop now&quot; or &quot;dbstop here&quot;. The at line number stuff can be useful, but for quick and dirty stuff I want to do:

dbstop now if ~isequal(input, expected_input);</description>
		<content:encoded><![CDATA[<p>Came here on a Google search&#8230; what I want (and am submitting an enhancement request for) is a &#8220;dbstop now&#8221; or &#8220;dbstop here&#8221;. The at line number stuff can be useful, but for quick and dirty stuff I want to do:</p>
<p>dbstop now if ~isequal(input, expected_input);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric S</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12952</link>
		<dc:creator>Eric S</dc:creator>
		<pubDate>Sun, 30 Nov 2008 19:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12952</guid>
		<description>I think the development team might have a look at &quot;proper&quot; IDEs, such as Visual Studio. When there is no debugging information available, the debugger breaks at the point in the stack where there is still information. The stack is fully there, but the use is not immediately pointed at the disassembly (unless specified in an option). 

In Matlab, this could be implemented via an additional path-like specification. The user can specify paths where the debugger should not break in a function within that path, but in the file calling this function. This would save the user to manually navigate up the stack to the relevant function. If the error is buried somewhere inside, then the  user still has the option to &quot;dbdown&quot; to the location of interest. 

GUI wise, there would be nice ways to implement this. 
The user could simply &quot;ignore&quot; files or their paths in the editor once Matlab ends up in the &quot;wrong&quot; function. 

Lastly, may I suggest the possibility to specify an &quot;entry-function&quot; for the editor? May be I miss it but when working with several files it is truly annoying to continuously switch back an forth between open files just to start the &quot;project&quot;, fix the error, go back, start the project, fix the error... 

Cheers,

Eric</description>
		<content:encoded><![CDATA[<p>I think the development team might have a look at &#8220;proper&#8221; IDEs, such as Visual Studio. When there is no debugging information available, the debugger breaks at the point in the stack where there is still information. The stack is fully there, but the use is not immediately pointed at the disassembly (unless specified in an option). </p>
<p>In Matlab, this could be implemented via an additional path-like specification. The user can specify paths where the debugger should not break in a function within that path, but in the file calling this function. This would save the user to manually navigate up the stack to the relevant function. If the error is buried somewhere inside, then the  user still has the option to &#8220;dbdown&#8221; to the location of interest. </p>
<p>GUI wise, there would be nice ways to implement this.<br />
The user could simply &#8220;ignore&#8221; files or their paths in the editor once Matlab ends up in the &#8220;wrong&#8221; function. </p>
<p>Lastly, may I suggest the possibility to specify an &#8220;entry-function&#8221; for the editor? May be I miss it but when working with several files it is truly annoying to continuously switch back an forth between open files just to start the &#8220;project&#8221;, fix the error, go back, start the project, fix the error&#8230; </p>
<p>Cheers,</p>
<p>Eric</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12940</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 19 Nov 2008 21:38:34 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12940</guid>
		<description>I have archived this discussion in the enhancement tracking database for the Development team to monitor.

Thanks,
Doug</description>
		<content:encoded><![CDATA[<p>I have archived this discussion in the enhancement tracking database for the Development team to monitor.</p>
<p>Thanks,<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morrison Lucas</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12939</link>
		<dc:creator>Morrison Lucas</dc:creator>
		<pubDate>Wed, 19 Nov 2008 20:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12939</guid>
		<description>Doug,

That&#039;s an interesting thought.

Of course in a perfect world the debugger would recognize the difference between the case you describe (I write bad code which causes an error further down the stack) and the case I was thinking of (I run cd(&#039;asdf&#039;) from the command line at some point during my day.)  It seems like there are two reasonable options:

(1)  Don&#039;t stop unless the error is explicitly in the file requested.  This is what I was thinking of when I wrote my original comment.  Of course this leads to the situation you described.  Still not a bad option to have.

(2)  Don&#039;t stop unless the file requested is somewhere in the stack when the error occurs.  This would kick over to the debugger whenever a problem could conceivably be found in the file I was working on, but would not force a stop when I have a fat-finger mistake somewhere else.  I like this better than #1.



So to flush this out a little bit, my request would now be:
A - add the following forms to DBSTOP
    (11a) DBSTOP in MFILE if error 
    (12a) DBSTOP in MFILE if caught error
    (13a) DBSTOP in MFILE if warning 
    (14a) DBSTOP in MFILE if naninf  or  DBSTOP if infnan
    (15a) DBSTOP in MFILE if error IDENTIFIER
    (16a) DBSTOP in MFILE if caught error IDENTIFIER
    (17a) DBSTOP in MFILE if warning IDENTIFIER

B - These forms would stop execution if
    B-i   The currently defined criteria for stopping was met
AND
    B-ii  The MFILE specified was present in the DBSTACK


This would stop execution whenever the MFILE either had an error, or exposed an error in some other code.  But it would not stop execution when I was doing work from the command line, or exercising some unrelated function.</description>
		<content:encoded><![CDATA[<p>Doug,</p>
<p>That&#8217;s an interesting thought.</p>
<p>Of course in a perfect world the debugger would recognize the difference between the case you describe (I write bad code which causes an error further down the stack) and the case I was thinking of (I run cd(&#8216;asdf&#8217;) from the command line at some point during my day.)  It seems like there are two reasonable options:</p>
<p>(1)  Don&#8217;t stop unless the error is explicitly in the file requested.  This is what I was thinking of when I wrote my original comment.  Of course this leads to the situation you described.  Still not a bad option to have.</p>
<p>(2)  Don&#8217;t stop unless the file requested is somewhere in the stack when the error occurs.  This would kick over to the debugger whenever a problem could conceivably be found in the file I was working on, but would not force a stop when I have a fat-finger mistake somewhere else.  I like this better than #1.</p>
<p>So to flush this out a little bit, my request would now be:<br />
A &#8211; add the following forms to DBSTOP<br />
    (11a) DBSTOP in MFILE if error<br />
    (12a) DBSTOP in MFILE if caught error<br />
    (13a) DBSTOP in MFILE if warning<br />
    (14a) DBSTOP in MFILE if naninf  or  DBSTOP if infnan<br />
    (15a) DBSTOP in MFILE if error IDENTIFIER<br />
    (16a) DBSTOP in MFILE if caught error IDENTIFIER<br />
    (17a) DBSTOP in MFILE if warning IDENTIFIER</p>
<p>B &#8211; These forms would stop execution if<br />
    B-i   The currently defined criteria for stopping was met<br />
AND<br />
    B-ii  The MFILE specified was present in the DBSTACK</p>
<p>This would stop execution whenever the MFILE either had an error, or exposed an error in some other code.  But it would not stop execution when I was doing work from the command line, or exercising some unrelated function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12918</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 29 Oct 2008 19:57:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12918</guid>
		<description>Mory,

I understand what you are looking for in an abstract way, but I am having some problems with understanding particulars.

If I am writing code, the bad code might be in *my* code, but might not manifest until a deep call, ie

sum(&#039;a&#039;, 1) %let&#039;s pretend this code caused an error in SUM

Would you want to stop?  The &#039;error&#039; is thrown by SUM which is not in your directory, so should it be skipped or not?  I personally want it to stop and then just run up the stack until I get to *my* code.

Like I said, I think there is something to this suggestion, but I am not sure what would cause a DBSTOP and what would not.

-Doug</description>
		<content:encoded><![CDATA[<p>Mory,</p>
<p>I understand what you are looking for in an abstract way, but I am having some problems with understanding particulars.</p>
<p>If I am writing code, the bad code might be in *my* code, but might not manifest until a deep call, ie</p>
<p>sum(&#8216;a&#8217;, 1) %let&#8217;s pretend this code caused an error in SUM</p>
<p>Would you want to stop?  The &#8216;error&#8217; is thrown by SUM which is not in your directory, so should it be skipped or not?  I personally want it to stop and then just run up the stack until I get to *my* code.</p>
<p>Like I said, I think there is something to this suggestion, but I am not sure what would cause a DBSTOP and what would not.</p>
<p>-Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morrison Lucas</title>
		<link>http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12914</link>
		<dc:creator>Morrison Lucas</dc:creator>
		<pubDate>Tue, 28 Oct 2008 17:56:32 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/28/matlab-basics-using-dbstop-if-error/#comment-12914</guid>
		<description>Hear hear!

I generally have one set of files that I&#039;m debugging, and desire the &quot;dbstop if error&quot; functionality for files in that set.  Everything else I don&#039;t want to hear about, just give me the error message and let&#039;s move on.

In terms of the interface, one possibility would be to implement the following calling convention:
    DBSTOP in MFILE if error
As well as the &quot;caught error&quot;, &quot;warning&quot; variants.

-Mory</description>
		<content:encoded><![CDATA[<p>Hear hear!</p>
<p>I generally have one set of files that I&#8217;m debugging, and desire the &#8220;dbstop if error&#8221; functionality for files in that set.  Everything else I don&#8217;t want to hear about, just give me the error message and let&#8217;s move on.</p>
<p>In terms of the interface, one possibility would be to implement the following calling convention:<br />
    DBSTOP in MFILE if error<br />
As well as the &#8220;caught error&#8221;, &#8220;warning&#8221; variants.</p>
<p>-Mory</p>
]]></content:encoded>
	</item>
</channel>
</rss>

