Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] [DSF] MIStack.getTopFrame


I think you are correct. The round about code is a historical artifact and should be cleaned up.

Cheers,
Pawel

On 09/23/2010 01:55 PM, Vladimir Prus wrote:
I am looking at MIStack.getTopFrame, and surely must be missing something. The essential
code goes like this:

         // Try to retrieve the top stack frame from the cached stopped event.
         if (fCachedStoppedEvent != null&&
             fCachedStoppedEvent.getFrame() != null&&
             execDmc.equals(fCachedStoppedEvent.getDMContext()))
         {
             rm.setData(createFrameDMContext(execDmc, fCachedStoppedEvent.getFrame().getLevel()));
             rm.done();
             return;
         }

However, to the best of my knowledge, the level of the frame in the *stopped response, is always
0. The code continues like that:

         // If stopped event is not available or doesn't contain frame info,
         // query top stack frame
         getFrames(
             ctx,
             0,
             0,
             new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
                 @Override
                 protected void handleSuccess() {
                     rm.setData(getData()[0]);
                     rm.done();
                 }
             });

So, we're requesting frame 0. Looking at getFrames, we see this:

            frameDMCs[i] = createFrameDMContext(execDmc, frame.getLevel());

When we request frame 0, frame.getLevel() will necessary return 0 as well.

Based on above, it seems that the entire body of getTopFrame can be replaced with:


             rm.setData(createFrameDMContext(execDmc, 0));
             rm.done();


What am I missing?

Thanks,




Back to the top