Bug 222882

Summary: Broken frame switching in gdb console in kdevelop4
Product: [Applications] kdevelop Reporter: Vasek Smidl <smidl>
Component: CPP DebuggerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: niko.sams
Priority: HI    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Vasek Smidl 2010-01-15 19:07:23 UTC
Version:            (using Devel)
Compiler:          g++ 4.4.1 
OS:                Linux
Installed from:    Compiled sources

When stopped at a breakpoint, changing frame in the Frame Stack does not switch the frame stack in gdb console.

1. assign breakpoint deep enough to have a few frames,
2. stop at the breakpoint (local variables are shown correctly)
3. change active frame in the stack (local variables are changed accordingly)
3. switch to the gdb prompt
4. type any command, e.g. "info f", all commands behave the same to me
5. info about stack level 0 is printed (local variables are also switched back to level 0)
Comment 1 Niko Sams 2010-01-15 21:55:40 UTC
The reason for this is that the Frame Stack is reloaded after executing the user command, and this seems to lose the current frame.
Comment 2 Niko Sams 2010-01-16 13:11:46 UTC
SVN commit 1075626 by nsams:

Don't reset currentFrame when reloading threads.
The issue that remains using the correct frame for NonMI commands.
CCBUG: 222882

 M  +2 -0      kdevelop/debuggers/gdb/debugsession.h  
 M  +24 -0     kdevelop/debuggers/gdb/unittests/gdbtest.cpp  
 M  +1 -0      kdevelop/debuggers/gdb/unittests/gdbtest.h  
 M  +7 -6      kdevplatform/debugger/framestack/framestackmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1075626
Comment 3 Vasek Smidl 2010-01-16 23:08:05 UTC
I tried the latest svn, rev 1075828 and the problem remains.
The application I am debugging is single-threaded.

It seems to me that the frame is not changed after executing the command but before. The command that is executed returns results related to frame 0.
Comment 4 Niko Sams 2010-01-17 09:29:56 UTC
That's why I didn't set the status to FIXED...

Try opening the variable view, kdevelop then sends one command with the changed frame and have it switched for your custom command. At least this worked for me.
Comment 5 Vasek Smidl 2010-01-17 14:42:04 UTC
Sorry, I thought the commit should have changed the behavior somehow.

Also, I am not following your suggestion. When I open variable view, I see Local variables related to the current frame, I see no other way how to change frame then the frame stack view.

However, I think it is not related to any views. I can change the frame but it does not stay there. 

It is probably in some code that is listening to gdb console. 
I observe the following:
1. stop in a breakpoint
2. switch to gdb prompt
3. type l - executed in frame 0
4. type up - tells you you are in frame 1
5. type l - executed in frame 1
6. type l - executed in frame 0

So, somewhere between 5 and 6, the frame was changed.
Comment 6 Niko Sams 2010-01-17 15:30:18 UTC
SVN commit 1076102 by nsams:

Reset currentFrame when entering PausedState.
CCBUG: 222882

 M  +11 -1     framestackmodel.cpp  
 M  +3 -0      framestackmodel.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1076102
Comment 7 Niko Sams 2010-01-17 15:31:46 UTC
Please try again with my latest commit.

Frame stack view is the only way to switch frames.

up does not switch frame correctly - thats a different issue (Bug 222967).