1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// dbgModel.cpp - debugger model
// - It contains the data and information related the debugging session
//
//////////////////////////////////////////////////////////////////////////
#include "pgAdmin3.h"
// wxWindows headers
#include <wx/wx.h>
#include "db/pgConn.h"
#include "db/pgQueryThread.h"
#include "db/pgQueryResultEvent.h"
#include "debugger/dbgModel.h"
dbgModel::dbgModel(Oid _target, pgConn *_conn)
: m_target(NULL), m_currLineNo(-1), m_targetPid(wxT("NULL"))
{
m_target = new dbgTargetInfo(_target, _conn);
}
bool dbgModel::GetSource(const wxString &_funcOid, dbgCachedStack *_cached)
{
dbgSourceHash::iterator match = m_sourceMap.find(_funcOid);
if (match == m_sourceMap.end())
return false;
else
{
if (_cached)
{
*_cached = match->second;
}
return true;
}
}
void dbgModel::ClearCachedSource()
{
m_sourceMap.clear();
// Put a dummy entry for invalid function OID to the cache. This is
// displayed at least for inline code blocks, as we currently have no way
// to fetch the source for those
m_sourceMap[wxT("0")] = dbgCachedStack(wxT("0"), wxT("0"), wxT(""), wxT(""), _("<source not available>"));
}
void dbgModel::AddSource(const wxString &_funcOid, const dbgCachedStack &_source)
{
m_sourceMap[_funcOid] = _source;
}
|