This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 80283 - *Gdb-lite* Implement "Step Out" action
Summary: *Gdb-lite* Implement "Step Out" action
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: Nikolay Molchanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-14 06:51 UTC by Nikolay Molchanov
Modified: 2009-06-25 10:59 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Molchanov 2006-07-14 06:51:45 UTC
This is IZ for a new feature: "Step Out" action.
The implementation should be similar to jpda debugger.
If program is stopped, button "Step Out" should be enabled. 
If user pressed button "Step Out", the execution should be resumed, 
stopping when the return from current function happen.
Comment 1 Nikolay Molchanov 2006-07-14 07:08:28 UTC
Unfortunately there is no good support for "Step Out" in gdb, 
so it is not clear how to implement it.
Comment 2 Nikolay Molchanov 2006-07-15 00:22:17 UTC
Actually there is "finish" command in gdb ("-exec-finish" in GDB/MI), which 
does exactly what we need to implement this feature (great thanks to Gordon 
- he helped me to find it). I upgraded priority to P1 because this feature 
should be implemented in Milestone 2B.

The suggested fix is to connect button "Step Out" via StepActionProvider
with method stepOut() in GdbDebuggerImpl.java, which calls method exec_finish()
in GdbProxy.java, which sends "-exec-finish" command to gdb.
To implement this solution three new methods are created:

File:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbDebuggerImpl.java

    /**
     * Resumes execution of the inferior program until 
     * the current function is exited.
     */
    public void stepOut() {
        setState(STATE_RUNNING);
        gdb.exec_finish();
    }

File:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxy.java

    /**
     * Resumes the execution of the inferior program until the current 
     * function is exited. 
     *
     * @return null if action is accepted, otherwise return error message
     */
    public String exec_finish() {
        String reply;
        reply = gdbProxyCL.exec_finish();
        return (reply);
    }

File:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyCL.java

    /**
     * Send "-exec-finish" to the debugger (finish this function)
     * This command resumes execution of the inferior program until 
     * the current function is exited.
     *
     * @return null if action is accepted, otherwise return error message
     */
    public String exec_finish() {
        String reply;
        String cmd;
        // Create MI command
        cmd = MI_CMD_EXEC_FINISH;
        reply = gdbProxy.gdbProxyML.sendCommand(cmd);
        return reply;
    }

The fix is integrated in "cnd-nb50-dev" branch.
-----------------------------------------------
Tag: cnd-nb50-dev
User: NikMolchanov
Date: 2006/07/14 15:53:47
Modified:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyCL.java
Revision: 1.1.2.32
------------------------------------------------
Tag: cnd-nb50-dev
User: NikMolchanov
Date: 2006/07/14 15:55:09
Modified:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxy.java
Revision: 1.1.2.21
------------------------------------------------
Tag: cnd-nb50-dev
User: NikMolchanov
Date: 2006/07/14 15:56:22
Modified:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbDebuggerImpl.java
Revision: 1.1.2.17
------------------------------------------------
Tag: cnd-nb50-dev
User: NikMolchanov
Date: 2006/07/14 16:00:54
Modified: 
cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/actions/StepActionProvider.java
Revision: 1.1.2.4
------------------------------------------------

For now button "Step Out" is always enabled while the debugging session 
is active. Additional changes are necessary to disable this button while
the program is running, and enable it back when the program is stopped.
Comment 3 _ gordonp 2006-09-07 16:05:50 UTC
Is this issue ready to be marked as fixed? If so, please change it.
Comment 4 Nikolay Molchanov 2006-09-08 15:19:26 UTC
The functionality is implemented and it seems to work just fine.
I changed the status to FIXED. If there are any problems feel free 
to reopen this issue or file another one.