Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
browser tracker issue on record position number
ollydbg:
I have tracked the source code, and found that:
--- Code: ---// ----------------------------------------------------------------------------
void JumpTracker::JumpDataAdd(const wxString& filename, const long posn, const long lineNum)
// ----------------------------------------------------------------------------
{
// Do not record old jump locations when a jump is in progress
// Caused by activating an editor inside the jump routines
if (m_bJumpInProgress)
return;
// Dont record position if line number is < 1 since a newly loaded
// file always reports an event for line 0
if (lineNum < 1) // user requested feature 2010/06/1
{
return;
}
// if current entry is identical, return
if (m_Cursor == JumpDataContains(filename, posn))
return;
// record new jump entry
size_t count = m_ArrayOfJumpData.GetCount();
m_Cursor += 1;
if ( m_Cursor > maxJumpEntries-1 )
m_Cursor = 0;
#if defined(LOGGING)
LOGIT( _T("JT JumpDataAdd[%s][%ld][%d]"), filename.c_str(), posn, m_Cursor);
#endif
do {
if ( count <= (size_t)m_Cursor )
{ //initialize new item
m_ArrayOfJumpData.Add(new JumpData(filename, posn));
//return;
break;
}
JumpData& jumpData = m_ArrayOfJumpData.Item(m_Cursor);
jumpData.SetFilename( filename );
jumpData.SetPosition( posn );
break;
}while(0);
#if defined(LOGGING)
wxCommandEvent evt;
OnMenuJumpDump(evt);
#endif
return;
}
--- End code ---
Here what is the logic of generate the m_Cursor?
I just enabled the debug logging, and found that if I just click on the editor header to activate the editor( not click on the editor content), then the m_Cursor is the position which does not belong to the current vision range?
Any one can explain this? (because I always meet an issue that when I jump back to some place I have never click on)
Thanks.
ollydbg:
I looked it further, and found that it do have some issue:
1, suppose that I have A.cpp and A.h
2, Now, Menu->View->Jump->Jump clear
3, navigate in A.h, so the Jump position was recorded correctly.
4, right click on a function declaration, and select "goto definition"
5, Now, you have goto A.cpp.
Here comes the bug:
Now, by looking at the debug trace output in BrowseTracker, two jump position of A.cpp was recorded.
One is the position when the A.cpp is activated(the BrowserTracker record one position), I call it PositionA.
The next one is the function body position in A.cpp, I call it PositionB.
Now, I click the "jump backward", the caret will first return to "PositionA" in the same source file (A.cpp), then click "jump backward" again I will return to A.h.
From my point of view, we should NOT record the "PositionA"., so that we can only click "jump backward" once to return to the function declaration in A.h.
Any ideas. :)
Edit
I simply comment out the line:
--- Code: --- JumpDataAdd(edFilename, edPosn, edstc->GetCurrentLine());
--- End code ---
In JumpTracker.cpp, OnEditorActivated function body, I think we do not need to record jump position there.
Pecan:
Thanks, I'll have a look at this.
Pecan:
Here's a patch that records only the de-activated editor position(rather than the new editor activated position).
There may be at least one position in the stack on which you have not clicked.
The extra position is placed there so that you may return to the last position of the de-activated editor.
Give it a try.
ollydbg:
--- Quote from: Pecan on January 11, 2012, 04:57:35 pm ---Here's a patch that records only the de-activated editor position(rather than the new editor activated position).
There may be at least one position in the stack on which you have not clicked.
The extra position is placed there so that you may return to the last position of the de-activated editor.
Give it a try.
--- End quote ---
Thank you very much!
I will test your patch in the weekend. (I'll have a travel right now)
Navigation
[0] Message Index
[#] Next page
Go to full version