[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Changeset]: filemarker and fix for 'dbstep in'
From: |
John W. Eaton |
Subject: |
[Changeset]: filemarker and fix for 'dbstep in' |
Date: |
Mon, 02 Jun 2008 18:41:04 -0400 |
On 25-May-2008, David Bateman wrote:
| The attached changeset fixes a bug my previous debug patch introduced
| and adds the filemarker function that is also useful for debugging. The
| bug was that the "dbstep in" command executed parts of the line
| individually rather than prevent the next breakpoint before the next
| line of executed of the function, as occurs with "dbstep", etc.
|
| The filemarker command itself is trivial, however it is then used to
| identify subfunctions. Consider that you have a function
|
| # string 1
| function z = testfun (x)
| # string 2
| y = 1;
| z = testfun2 (x, y);
| end
| # string 3
| function z = testfun2 (x, y)
| # string 4
| z = x + y;
| end
|
| then filemarker can be used like
|
| help (["testfun", filemarker, "testfun2"])
|
| or knowing that filemarker is by default ">", then
|
| help testfun>testfun2
|
| gives the same result. Other uses include in dbstop to set a breakpoint
| in a subfunction, for example
|
| dbstop testfun>testfun2
|
| set the breakpoint at the first line of the testfun2 subfunction. I also
| adapted the backtrace method so that dbstack gives the name of the
| subfunctions including their parent functions..
|
| Note that the symbol_table:;find_function method will have to be adapted
| if we ever decide to implement nested functions as matlab stupidly uses
| the filesep character to define the nesting rather than the filemarker
| character. That is, if we have a function like
|
| function f1
| function f2
| end
| function f3
| end
| end
| function f2
| end
|
| then to set breakpoints in each of these functions is done like
|
| dbstop f1
| dbstop f1>f1/f2
| dbstop f1>f3
| dbstop f1>f2
OK.
| If matlab had used filemarker instead of filesep for the nesting, then
| the current adaptation of symbol_table::find_function would already be
| correct.
It seems like it would be better if we could simply write
f1/f2
to stop in the nested function and
f1>f2
to stop in the subfunction. But whatever. It doesn't seem that
important.
| Note that I allowed the filemarker character to be set,
OK, but is there really any need to change it?
I applied the changeset.
Thanks,
jwe
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Changeset]: filemarker and fix for 'dbstep in',
John W. Eaton <=