Expected behaviour of dbtype

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Expected behaviour of dbtype

Richard Crozier
Hello,

The help for dbtype states:

"When called with no arguments in debugging mode, display the script
file currently being debugged."

 From this I expected that dbtype would print the function currently
stopped in the stack. So for instance, if I'm stopped in a function foo
which is called by a function bar, and I navigate up to bar by doing
dbup, I would have expected that dbtype would now print out bar.
However, as far as I can tell, it still prints out foo no matter where I
navigate too.

Is this the expected behaviour of dbtype, or a bug?

Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

John W. Eaton
Administrator
On 02/23/2016 08:35 AM, Richard Crozier wrote:

> Hello,
>
> The help for dbtype states:
>
> "When called with no arguments in debugging mode, display the script
> file currently being debugged."
>
>  From this I expected that dbtype would print the function currently
> stopped in the stack. So for instance, if I'm stopped in a function foo
> which is called by a function bar, and I navigate up to bar by doing
> dbup, I would have expected that dbtype would now print out bar.
> However, as far as I can tell, it still prints out foo no matter where I
> navigate too.
>
> Is this the expected behaviour of dbtype, or a bug?

Sounds like a bug to me but I don't know what Matlab does.

jwe



Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

Richard Crozier
On 23/02/16 14:16, John W. Eaton wrote:

> On 02/23/2016 08:35 AM, Richard Crozier wrote:
>> Hello,
>>
>> The help for dbtype states:
>>
>> "When called with no arguments in debugging mode, display the script
>> file currently being debugged."
>>
>>  From this I expected that dbtype would print the function currently
>> stopped in the stack. So for instance, if I'm stopped in a function foo
>> which is called by a function bar, and I navigate up to bar by doing
>> dbup, I would have expected that dbtype would now print out bar.
>> However, as far as I can tell, it still prints out foo no matter where I
>> navigate too.
>>
>> Is this the expected behaviour of dbtype, or a bug?
>
> Sounds like a bug to me but I don't know what Matlab does.
>
> jwe
>
>
>

Matlab's dbtype doesn't work in the same way, you must supply the
function name. It only supports the following syntax:

     dbtype FILESPEC
     dbtype FILESPEC RANGE

So it's really your choice on how you want it work in Octave in the
debugging case. Octave's feature for printing out lines from the current
file you're debugging is a nice improvement over Matlab, but it would be
even more useful if it printed out the function you've actually
navigated to in the function stack. I've only actually tried this when
stopped at an error so I don't know if the behaviour is different if
stopped at a break point.

Richard


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

Rik-4
In reply to this post by Richard Crozier
On 02/23/2016 09:00 AM, [hidden email] wrote:
Subject:
Re: Expected behaviour of dbtype
From:
Richard Crozier [hidden email]
Date:
02/23/2016 06:36 AM
To:
"John W. Eaton" [hidden email], Octave Maintainers [hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
7bit
Precedence:
list
MIME-Version:
1.0
References:
[hidden email] [hidden email]
In-Reply-To:
[hidden email]
Message-ID:
[hidden email]
Content-Type:
text/plain; charset=utf-8; format=flowed
Message:
4

On 23/02/16 14:16, John W. Eaton wrote:
On 02/23/2016 08:35 AM, Richard Crozier wrote:
Hello,

The help for dbtype states:

"When called with no arguments in debugging mode, display the script
file currently being debugged."

 From this I expected that dbtype would print the function currently
stopped in the stack. So for instance, if I'm stopped in a function foo
which is called by a function bar, and I navigate up to bar by doing
dbup, I would have expected that dbtype would now print out bar.
However, as far as I can tell, it still prints out foo no matter where I
navigate too.

Is this the expected behaviour of dbtype, or a bug?

Sounds like a bug to me but I don't know what Matlab does.

jwe




Matlab's dbtype doesn't work in the same way, you must supply the function name. It only supports the following syntax:

    dbtype FILESPEC
    dbtype FILESPEC RANGE

So it's really your choice on how you want it work in Octave in the debugging case. Octave's feature for printing out lines from the current file you're debugging is a nice improvement over Matlab, but it would be even more useful if it printed out the function you've actually navigated to in the function stack. I've only actually tried this when stopped at an error so I don't know if the behaviour is different if stopped at a break point.

The other command that I find more useful, so useful in fact that I copied it from gdb and implemented it in Octave, is dblist.  It shows the code immediately around where the debugger is stopped.  It is less cumbersome than having to enter a RANGE into dbtype.

But, to your point, the debugger would be more useful if it followed where you were in the stack.  Can you file a bug report on Savannah about that?

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

John W. Eaton
Administrator
On 02/23/2016 12:26 PM, Rik wrote:

> The other command that I find more useful, so useful in fact that I
> copied it from gdb and implemented it in Octave, is dblist.  It shows
> the code immediately around where the debugger is stopped.  It is less
> cumbersome than having to enter a RANGE into dbtype.
>
> But, to your point, the debugger would be more useful if it followed
> where you were in the stack.  Can you file a bug report on Savannah
> about that?

I checked in the following changeset:

   http://hg.savannah.gnu.org/hgweb/octave/rev/909129eb77c5

It seems to work more like I would expect now.

jwe



Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

Mike Miller-4
On Tue, Feb 23, 2016 at 15:07:10 -0500, John W. Eaton wrote:

> On 02/23/2016 12:26 PM, Rik wrote:
>
> >The other command that I find more useful, so useful in fact that I
> >copied it from gdb and implemented it in Octave, is dblist.  It shows
> >the code immediately around where the debugger is stopped.  It is less
> >cumbersome than having to enter a RANGE into dbtype.
> >
> >But, to your point, the debugger would be more useful if it followed
> >where you were in the stack.  Can you file a bug report on Savannah
> >about that?
>
> I checked in the following changeset:
>
>   http://hg.savannah.gnu.org/hgweb/octave/rev/909129eb77c5
>
> It seems to work more like I would expect now.

This changeset causes some tests to turn into infinite loops. I bisected
to verify this was the cause of what I'm seeing. The first test when
running "make check" hangs.

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

John W. Eaton
Administrator
On 02/23/2016 09:36 PM, Mike Miller wrote:

> On Tue, Feb 23, 2016 at 15:07:10 -0500, John W. Eaton wrote:
>> On 02/23/2016 12:26 PM, Rik wrote:
>>
>>> The other command that I find more useful, so useful in fact that I
>>> copied it from gdb and implemented it in Octave, is dblist.  It shows
>>> the code immediately around where the debugger is stopped.  It is less
>>> cumbersome than having to enter a RANGE into dbtype.
>>>
>>> But, to your point, the debugger would be more useful if it followed
>>> where you were in the stack.  Can you file a bug report on Savannah
>>> about that?
>>
>> I checked in the following changeset:
>>
>>    http://hg.savannah.gnu.org/hgweb/octave/rev/909129eb77c5
>>
>> It seems to work more like I would expect now.
>
> This changeset causes some tests to turn into infinite loops. I bisected
> to verify this was the cause of what I'm seeing. The first test when
> running "make check" hangs.

Oops.  I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/1d8e020d86df

jwe



Reply | Threaded
Open this post in threaded view
|

Re: Expected behaviour of dbtype

Richard Crozier
In reply to this post by Rik-4
On 23/02/16 17:26, Rik wrote:
<snip>

>>
> The other command that I find more useful, so useful in fact that I
> copied it from gdb and implemented it in Octave, is dblist.  It shows
> the code immediately around where the debugger is stopped.  It is less
> cumbersome than having to enter a RANGE into dbtype.
>
> But, to your point, the debugger would be more useful if it followed
> where you were in the stack.  Can you file a bug report on Savannah
> about that?
>
> --Rik
>

Thanks for this tip, and the very responsive reaction to my feature
request by you and jwe!

Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.