Skip to content

Commit

Permalink
Fixed: when switching between callstack frames, the 'Locals' view was…
Browse files Browse the repository at this point in the history
… not updated properly
  • Loading branch information
eranif committed Jun 28, 2014
1 parent bf6114c commit 7930df0
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 71 deletions.
9 changes: 2 additions & 7 deletions Debugger/dbgcmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,13 +797,8 @@ bool DbgCmdStackList::ProcessOutput(const wxString &line)

bool DbgCmdSelectFrame::ProcessOutput(const wxString &line)
{
wxUnusedVar(line);

DebuggerEventData e;
e.m_updateReason = DBG_UR_GOT_CONTROL;
e.m_controlReason = DBG_END_STEPPING;
e.m_frameInfo.function = wxEmptyString;
m_observer->DebuggerUpdate( e );
clCommandEvent evt(wxEVT_DEBUGGER_FRAME_SELECTED);
EventNotifier::Get()->AddPendingEvent( evt );
return true;
}

Expand Down
8 changes: 2 additions & 6 deletions Debugger/debuggergdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,7 @@ bool DbgGdb::QueryFileLine()

bool DbgGdb::QueryLocals()
{
bool res = WriteCommand( wxT( "-stack-list-locals 2" ), new DbgCmdHandlerLocals( m_observer ) );
if ( !res ) {
return false;
}
return WriteCommand( wxT( "-stack-list-arguments 2 0 0 " ), new DbgCmdHandlerFuncArgs( m_observer ) );
return WriteCommand( wxT( "-stack-list-variables 2" ), new DbgCmdHandlerLocals( m_observer ) );
}

bool DbgGdb::ExecuteCmd( const wxString &cmd )
Expand Down Expand Up @@ -883,7 +879,7 @@ bool DbgGdb::ListFrames()
bool DbgGdb::SetFrame( int frame )
{
wxString command;
command << wxT( "frame " ) << frame;
command << wxT( "-stack-select-frame " ) << frame;
return WriteCommand( command, new DbgCmdSelectFrame( m_observer ) );
}

Expand Down
13 changes: 13 additions & 0 deletions LiteEditor/localstable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <wx/xrc/xmlres.h>
#include "frame.h"
#include "drawingutils.h"
#include "event_notifier.h"

BEGIN_EVENT_TABLE(LocalsTable, DebuggerTreeListCtrlBase)
EVT_MENU(XRCID("Change_Value"), LocalsTable::OnEditValue)
Expand All @@ -28,6 +29,8 @@ LocalsTable::LocalsTable(wxWindow *parent)
m_DBG_USERR = DBG_USERR_LOCALS;
m_QUERY_NUM_CHILDS = QUERY_LOCALS_CHILDS;
m_LIST_CHILDS = LIST_LOCALS_CHILDS;

EventNotifier::Get()->Connect(wxEVT_DEBUGGER_FRAME_SELECTED, clCommandEventHandler(LocalsTable::OnStackSelected), NULL, this);
}

LocalsTable::~LocalsTable()
Expand Down Expand Up @@ -454,3 +457,13 @@ void LocalsTable::UpdateFuncReturnValue(const wxString& retValueGdbId)
evt.SetItem(item);
OnItemExpanding(evt);
}

void LocalsTable::OnStackSelected(clCommandEvent& event)
{
event.Skip();
Clear();
IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger();
if ( dbgr && dbgr->IsRunning() ) {
dbgr->QueryLocals();
}
}
107 changes: 54 additions & 53 deletions LiteEditor/localstable.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,63 +23,64 @@
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

#ifndef __localstable__
#define __localstable__

#include "simpletablebase.h"
#include <wx/arrstr.h>
#include "debuggerobserver.h"
#include "debuggersettings.h"

#define LIST_LOCALS_CHILDS 600
#define QUERY_LOCALS_CHILDS 601
#define QUERY_LOCALS_CHILDS_FAKE_NODE 602

class LocalsTable : public DebuggerTreeListCtrlBase
{

DebuggerPreDefinedTypes m_preDefTypes;
bool m_resolveLocals;
bool m_arrayAsCharPtr;

protected:
void DoClearNonVariableObjectEntries(wxArrayString& itemsNotRemoved, size_t flags, std::map<wxString, wxString> &oldValues);
void DoUpdateLocals (const LocalVariables& locals, size_t kind);

// Events
void OnItemExpanding (wxTreeEvent& event);
void OnRefresh (wxCommandEvent& event);
void OnRefreshUI (wxUpdateUIEvent& event);
void OnItemRightClick(wxTreeEvent& event);
void OnEditValue (wxCommandEvent &event);
void OnEditValueUI (wxUpdateUIEvent &event);

#ifndef __localstable__
#define __localstable__

#include "simpletablebase.h"
#include <wx/arrstr.h>
#include "debuggerobserver.h"
#include "debuggersettings.h"
#include "cl_command_event.h"

#define LIST_LOCALS_CHILDS 600
#define QUERY_LOCALS_CHILDS 601
#define QUERY_LOCALS_CHILDS_FAKE_NODE 602

class LocalsTable : public DebuggerTreeListCtrlBase
{

DebuggerPreDefinedTypes m_preDefTypes;
bool m_resolveLocals;
bool m_arrayAsCharPtr;

protected:
void DoClearNonVariableObjectEntries(wxArrayString& itemsNotRemoved, size_t flags, std::map<wxString, wxString> &oldValues);
void DoUpdateLocals (const LocalVariables& locals, size_t kind);

// Events
void OnItemExpanding (wxTreeEvent& event);
void OnRefresh (wxCommandEvent& event);
void OnRefreshUI (wxUpdateUIEvent& event);
void OnItemRightClick(wxTreeEvent& event);
void OnEditValue (wxCommandEvent &event);
void OnEditValueUI (wxUpdateUIEvent &event);
void OnStackSelected (clCommandEvent &event);
public:
LocalsTable(wxWindow *parent);
virtual ~LocalsTable();
LocalsTable(wxWindow *parent);
virtual ~LocalsTable();

public:
/**
* @brief callback to IDebugger::CreateVariableObject
* @param event
*/
void OnCreateVariableObj (const DebuggerEventData& event);
/**
* @brief callback to IDebugger::ListChildren
*/
void OnListChildren (const DebuggerEventData& event);
/**
* @brief called to IDEbugger::UpdateVariableObject
*/
void OnVariableObjUpdate (const DebuggerEventData& event);
/**
* @brief callback to IDebugger::CreateVariableObject
* @param event
*/
void OnCreateVariableObj (const DebuggerEventData& event);
/**
* @brief callback to IDebugger::ListChildren
*/
void OnListChildren (const DebuggerEventData& event);
/**
* @brief called to IDEbugger::UpdateVariableObject
*/
void OnVariableObjUpdate (const DebuggerEventData& event);

void UpdateLocals (const LocalVariables& locals);
void UpdateFrameInfo();
void UpdateLocals (const LocalVariables& locals);
void UpdateFrameInfo();

void UpdateFuncArgs (const LocalVariables& args);
void UpdateFuncReturnValue(const wxString& retValueGdbId);
void Initialize ();
void UpdateFuncArgs (const LocalVariables& args);
void UpdateFuncReturnValue(const wxString& retValueGdbId);
void Initialize ();

DECLARE_EVENT_TABLE();
DECLARE_EVENT_TABLE();
};
#endif // __localstable__
#endif // __localstable__
4 changes: 1 addition & 3 deletions Plugin/debuggermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ const wxEventType wxEVT_DEBUGGER_QUERY_FILELINE = ::wxNewEventType();
const wxEventType wxEVT_DEBUGGER_TYPE_RESOLVE_ERROR = ::wxNewEventType();
const wxEventType wxEVT_DEBUGGER_LIST_REGISTERS = ::wxNewEventType();
const wxEventType wxEVT_DEBUGGER_LIST_FRAMES = ::wxNewEventType();

//const wxEventType wxEVT_DEBUGGER_QUERY_FUNCARGS = ::wxNewEventType();
//const wxEventType wxEVT_DEBUGGER_UPDATE_VAROBJECT = ::wxNewEventType();
const wxEventType wxEVT_DEBUGGER_FRAME_SELECTED = ::wxNewEventType();

DebuggerMgr::DebuggerMgr()
{
Expand Down
4 changes: 2 additions & 2 deletions Plugin/debuggermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ extern WXDLLIMPEXP_SDK const wxEventType wxEVT_DEBUGGER_LIST_REGISTERS;
// Call stack
extern WXDLLIMPEXP_SDK const wxEventType wxEVT_DEBUGGER_LIST_FRAMES;

//extern WXDLLIMPEXP_SDK const wxEventType wxEVT_DEBUGGER_QUERY_FUNCARGS;
//extern WXDLLIMPEXP_SDK const wxEventType wxEVT_DEBUGGER_UPDATE_VAROBJECT;
// frame selected (user double clicked a stack entry)
extern WXDLLIMPEXP_SDK const wxEventType wxEVT_DEBUGGER_FRAME_SELECTED;

class WXDLLIMPEXP_SDK DebuggerMgr
{
Expand Down

0 comments on commit 7930df0

Please sign in to comment.