Commit b781012b authored by Kavindra Devi Palaraja's avatar Kavindra Devi Palaraja
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 79f99fea c1e0a788
......@@ -171,7 +171,7 @@ void CdbSymbolGroupContext::populateINameIndexMap(const QString &prefix, unsigne
}
}
QString CdbSymbolGroupContext::toString() const
QString CdbSymbolGroupContext::toString(bool verbose) const
{
QString rc;
QTextStream str(&rc);
......@@ -186,10 +186,12 @@ QString CdbSymbolGroupContext::toString() const
str << " '" << getSymbolString(m_symbolGroup, &IDebugSymbolGroup2::GetSymbolTypeNameWide, i);
str << p << '\n';
}
str << "NameIndexMap\n";
NameIndexMap::const_iterator ncend = m_inameIndexMap.constEnd();
for (NameIndexMap::const_iterator it = m_inameIndexMap.constBegin() ; it != ncend; ++it)
str << it.key() << ' ' << it.value() << '\n';
if (verbose) {
str << "NameIndexMap\n";
NameIndexMap::const_iterator ncend = m_inameIndexMap.constEnd();
for (NameIndexMap::const_iterator it = m_inameIndexMap.constBegin() ; it != ncend; ++it)
str << it.key() << ' ' << it.value() << '\n';
}
return rc;
}
......@@ -301,7 +303,7 @@ bool CdbSymbolGroupContext::expandSymbol(const QString &prefix, unsigned long in
it.value() += newSymbolCount;
// insert the new symbols
populateINameIndexMap(prefix, index, index + 1, newSymbolCount);
if (debugCDB)
if (debugCDB > 1)
qDebug() << '<' << Q_FUNC_INFO << '\n' << prefix << index << '\n' << toString();
return true;
}
......@@ -397,17 +399,16 @@ private:
static bool insertChildrenRecursion(const QString &iname,
CdbSymbolGroupContext *sg,
WatchHandler *watchHandler,
int visibleLevel,
bool forceRecursion,
int level,
QString *errorMessage,
int *childCount = 0);
// Insert a symbol and its children recursively if
// they are known.
// Insert a symbol (and its first level children depending on forceRecursion)
static bool insertSymbolRecursion(WatchData wd,
CdbSymbolGroupContext *sg,
WatchHandler *watchHandler,
int visibleLevel,
bool forceRecursion,
int level,
QString *errorMessage)
{
......@@ -415,29 +416,24 @@ static bool insertSymbolRecursion(WatchData wd,
*errorMessage = QString::fromLatin1("Max recursion level %1 reached for '%2', bailing out.").arg(level).arg(wd.iname);
return false;
}
// Find out whether to recurse (either children are already
// available in the context or the parent item is visible
// in the view (which means its children must be complete)
// or the view item is expanded).
bool recurse = false;
if (wd.childCount || wd.isChildrenNeeded()) {
const bool contextExpanded = sg->isExpanded(wd.iname);
const bool viewExpanded = watchHandler->isExpandedIName(wd.iname);
if (viewExpanded)
visibleLevel = level;
recurse = contextExpanded || (level - visibleLevel < 2);
}
// Find out whether to recurse (has children or at least knows it has children)
const bool recurse = forceRecursion && (wd.childCount > 0 || wd.isChildrenNeeded());
if (debugCDB)
qDebug() << Q_FUNC_INFO << '\n' << wd.iname << "level=" << level << "visibleLevel=" << visibleLevel << "recurse=" << recurse;
qDebug() << Q_FUNC_INFO << '\n' << wd.iname << "level=" << level << "recurse=" << recurse;
bool rc = true;
if (recurse) { // Determine number of children and indicate in model
int childCount;
rc = insertChildrenRecursion(wd.iname, sg, watchHandler, visibleLevel, level, errorMessage, &childCount);
rc = insertChildrenRecursion(wd.iname, sg, watchHandler, false, level, errorMessage, &childCount);
if (rc) {
wd.setChildCount(childCount);
wd.setChildrenUnneeded();
}
} else {
// No further recursion at this level, pretend entry is complete
if (wd.isChildrenNeeded()) {
wd.setChildCount(1);
wd.setChildrenUnneeded();
}
}
if (debugCDB)
qDebug() << " INSERTING: at " << level << wd.toString();
......@@ -449,7 +445,7 @@ static bool insertSymbolRecursion(WatchData wd,
static bool insertChildrenRecursion(const QString &iname,
CdbSymbolGroupContext *sg,
WatchHandler *watchHandler,
int visibleLevel,
bool forceRecursion,
int level,
QString *errorMessage,
int *childCountPtr)
......@@ -458,7 +454,7 @@ static bool insertChildrenRecursion(const QString &iname,
qDebug() << Q_FUNC_INFO << '\n' << iname << level;
QList<WatchData> watchList;
// Implicitly enforces expansion
// This implicitly enforces expansion
if (!sg->getChildSymbols(iname, WatchDataBackInserter(watchList), errorMessage))
return false;
......@@ -469,7 +465,7 @@ static bool insertChildrenRecursion(const QString &iname,
for (int c = 0; c < childCount; c++) {
const WatchData &wd = watchList.at(c);
if (wd.isValid()) { // We sometimes get empty names for deeply nested data
if (!insertSymbolRecursion(wd, sg, watchHandler, visibleLevel, level + 1, errorMessage))
if (!insertSymbolRecursion(wd, sg, watchHandler, forceRecursion, level + 1, errorMessage))
return false;
succeededChildCount++;
} else {
......@@ -493,28 +489,17 @@ bool CdbSymbolGroupContext::populateModelInitially(CdbSymbolGroupContext *sg,
if (!sg->expandTopLevel(errorMessage))
return false;
// Insert root items and known children.
// Insert root items and known children of level 1
QList<WatchData> watchList;
if (!sg->getChildSymbols(sg->prefix(), WatchDataBackInserter(watchList), errorMessage))
return false;
foreach(const WatchData &wd, watchList)
if (!insertSymbolRecursion(wd, sg, watchHandler, 0, 0, errorMessage))
if (!insertSymbolRecursion(wd, sg, watchHandler, true, 0, errorMessage))
return false;
return true;
}
static inline QString parentIName(QString iname)
{
const int lastDotPos = iname.lastIndexOf(QLatin1Char('.'));
if (lastDotPos == -1) {
iname.clear();
} else {
iname.truncate(lastDotPos);
}
return iname;
}
bool CdbSymbolGroupContext::completeModel(CdbSymbolGroupContext *sg,
WatchHandler *watchHandler,
QString *errorMessage)
......@@ -522,21 +507,21 @@ bool CdbSymbolGroupContext::completeModel(CdbSymbolGroupContext *sg,
const QList<WatchData> incomplete = watchHandler->takeCurrentIncompletes();
if (debugCDB)
qDebug().nospace() << "###>" << Q_FUNC_INFO << ' ' << incomplete.size() << '\n';
// At this point, it should be nodes with unknown children.
// Complete and re-insert provided their grand parent is expanded
// (rule being that children are displayed only if they are complete, that is,
// their children are known).
foreach(WatchData wd, incomplete) {
const bool grandParentExpanded = watchHandler->isExpandedIName(parentIName(parentIName(wd.iname)));
// The view reinserts any node being expanded with flag 'ChildrenNeeded'.
// Expand next level in context unless this is already the case.
foreach(WatchData wd, incomplete) {
const bool contextExpanded = sg->isExpanded(wd.iname);
if (debugCDB)
qDebug() << " " << wd.iname << "grandParentExpanded=" << grandParentExpanded;
if (grandParentExpanded) {
if (!insertSymbolRecursion(wd, sg, watchHandler, 0, 1, errorMessage))
qDebug() << " " << wd.iname << "CE=" << contextExpanded;
if (contextExpanded) { // You know that already.
wd.setChildrenUnneeded();
watchHandler->insertData(wd);
} else {
if (!insertSymbolRecursion(wd, sg, watchHandler, true, 0, errorMessage))
return false;
}
}
if (debugCDB)
qDebug() << "###<" << Q_FUNC_INFO;
watchHandler->rebuildModel();
return true;
}
......
......@@ -93,7 +93,7 @@ private:
bool init(QString *errorMessage);
void clear();
QString toString() const;
QString toString(bool verbose = false) const;
bool getChildSymbolsPosition(const QString &prefix,
unsigned long *startPos,
unsigned long *parentId,
......
......@@ -1053,6 +1053,15 @@ void DebuggerManager::sessionLoaded()
loadSessionData();
}
void DebuggerManager::sessionUnloaded()
{
cleanupViews();
if (m_engine)
m_engine->shutdown();
setStatus(DebuggerProcessNotReady);
setBusyCursor(false);
}
void DebuggerManager::aboutToSaveSession()
{
saveSessionData();
......
......@@ -233,6 +233,7 @@ public slots:
void updateWatchModel();
void sessionLoaded();
void sessionUnloaded();
void aboutToSaveSession();
void assignValueInDebugger();
......
......@@ -752,6 +752,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
m_manager, SLOT(sessionLoaded()));
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
m_manager, SLOT(aboutToSaveSession()));
connect(sessionManager(), SIGNAL(sessionUnloaded()),
m_manager, SLOT(sessionUnloaded()));
// EditorManager
QObject *editorManager = core->editorManager();
......
......@@ -389,6 +389,19 @@ void GdbEngine::handleResponse(const QByteArray &buff)
handleAsyncOutput(record);
} else if (asyncClass == "running") {
// Archer has 'thread-id="all"' here
} else if (asyncClass == "library-loaded") {
// Archer has 'id="/usr/lib/libdrm.so.2",
// target-name="/usr/lib/libdrm.so.2",
// host-name="/usr/lib/libdrm.so.2",
// symbols-loaded="0"
} else if (asyncClass == "thread-group-created") {
// Archer has "{id="28902"}"
} else if (asyncClass == "thread-created") {
//"{id="1",group-id="28902"}"
} else if (asyncClass == "thread-group-exited") {
// Archer has "{id="28902"}"
} else if (asyncClass == "thread-exited") {
//"{id="1",group-id="28902"}"
#ifdef Q_OS_MAC
} else if (asyncClass == "shlibs-updated") {
// MAC announces updated libs
......
......@@ -54,7 +54,6 @@ class RegisterHandler : public QAbstractTableModel
public:
RegisterHandler(QObject *parent = 0);
void sessionClosed();
QAbstractItemModel *model() { return this; }
bool isEmpty() const; // nothing known so far?
......
......@@ -202,6 +202,8 @@ QString WatchData::toString() const
str << "parent=\"" << parentIndex << doubleQuoteComma;
if (row != -1)
str << "row=\"" << row << doubleQuoteComma;
if (childCount)
str << "childCount=\"" << childCount << doubleQuoteComma;
if (const int childCount = childIndex.size()) {
str << "child=\"";
for (int i = 0; i < childCount; i++) {
......
This diff is collapsed.
......@@ -73,10 +73,11 @@ signals:
void indentRegion(int *amount, int beginLine, int endLine, QChar typedChar);
void completionRequested();
public:
class Private;
private:
bool eventFilter(QObject *ob, QEvent *ev);
class Private;
friend class Private;
Private *d;
};
......
......@@ -996,16 +996,16 @@ void SessionManager::removeProjects(QList<Project *> remove)
void SessionManager::setValue(const QString &name, const QVariant &value)
{
m_file->m_values.insert(name, value);
if (m_file)
m_file->m_values.insert(name, value);
}
QVariant SessionManager::value(const QString &name)
{
QMap<QString, QVariant>::const_iterator it = m_file->m_values.find(name);
if (it != m_file->m_values.constEnd())
return *it;
else
if (!m_file)
return QVariant();
QMap<QString, QVariant>::const_iterator it = m_file->m_values.find(name);
return (it == m_file->m_values.constEnd()) ? QVariant() : *it;
}
QString SessionManager::activeSession() const
......
......@@ -85,7 +85,7 @@ QStringList QMakeStep::arguments(const QString &buildConfiguration)
if (!(defaultBuildConfiguration & QtVersion::DebugBuild) && (projectBuildConfiguration & QtVersion::DebugBuild))
configarguments << "CONFIG+=debug";
if (!configarguments.isEmpty())
arguments << "-after" << configarguments;
arguments << configarguments;
} else {
arguments << "CONFIG+=debug_and_release";
}
......
......@@ -1453,7 +1453,7 @@ QString QtVersion::buildDebuggingHelperLibrary()
output += QString("Building debugging helper library in %1\n").arg(directory);
output += "\n";
output += "Runinng qmake...\n";
output += QString("Runinng %1 ...\n").arg(qmakeCommand());
QProcess qmake;
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
......@@ -1487,7 +1487,7 @@ QString QtVersion::buildDebuggingHelperLibrary()
QString makeFullPath = env.searchInPath(make);
output += "\n";
if (!makeFullPath.isEmpty()) {
output += QString("Running %1...\n").arg(makeFullPath);
output += QString("Running %1 ...\n").arg(makeFullPath);
qmake.start(makeFullPath, QStringList());
qmake.waitForFinished();
output += qmake.readAll();
......
......@@ -13,6 +13,11 @@ rm -f javascriptlexer_p.h
rm -f javascriptmemorypool_p.h
rm -f javascriptnodepool_p.h
rm -f javascriptgrammar_p.h
rm -f javascriptgrammar.cpp
rm -f javascriptparser_p.h
rm -f javascriptparser.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscript.g > javascript.g
sed -f $me/cmd.sed $QTDIR/src/script/qscriptast.cpp > javascriptast.cpp
......@@ -25,7 +30,7 @@ sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer.cpp > javascriptlexer.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptmemorypool_p.h > javascriptmemorypool_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptnodepool_p.h > javascriptnodepool_p.h
qlalr $me/javascript.g
qlalr --troll --no-lines --no-debug $me/javascript.g
chmod ugo-w javascript.g
chmod ugo-w javascriptast.cpp
......
......@@ -214,6 +214,7 @@
#include "javascriptastfwd_p.h"
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
......@@ -259,18 +260,48 @@ public:
int endColumn;
};
struct DiagnosticMessage {
enum Kind { Warning, Error };
DiagnosticMessage()
: kind(Error), line(0), column(0) {}
DiagnosticMessage(Kind kind, int line, int column, const QString &message)
: kind(kind), line(line), column(column), message(message) {}
Kind kind;
int line;
int column;
QString message;
};
public:
JavaScriptParser();
~JavaScriptParser();
bool parse(JavaScriptEnginePrivate *driver);
QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; }
inline DiagnosticMessage diagnosticMessage() const
{
foreach (const DiagnosticMessage &d, diagnostic_messages) {
if (! d.kind == DiagnosticMessage::Warning)
return d;
}
return DiagnosticMessage();
}
inline QString errorMessage() const
{ return error_message; }
{ return diagnosticMessage().message; }
inline int errorLineNumber() const
{ return error_lineno; }
{ return diagnosticMessage().line; }
inline int errorColumnNumber() const
{ return error_column; }
{ return diagnosticMessage().column; }
protected:
inline void reallocateStack();
......@@ -287,9 +318,24 @@ protected:
Value *sym_stack;
int *state_stack;
Location *location_stack;
QString error_message;
int error_lineno;
int error_column;
// error recovery
enum { TOKEN_BUFFER_SIZE = 3 };
struct SavedToken {
int token;
double dval;
Location loc;
};
double yylval;
Location yylloc;
SavedToken token_buffer[TOKEN_BUFFER_SIZE];
SavedToken *first_token;
SavedToken *last_token;
QList<DiagnosticMessage> diagnostic_messages;
};
inline void JavaScriptParser::reallocateStack()
......@@ -332,8 +378,8 @@ JavaScriptParser::JavaScriptParser():
sym_stack(0),
state_stack(0),
location_stack(0),
error_lineno(0),
error_column(0)
first_token(0),
last_token(0)
{
}
......@@ -358,56 +404,48 @@ static inline JavaScriptParser::Location location(JavaScript::Lexer *lexer)
bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
{
const int INITIAL_STATE = 0;
JavaScript::Lexer *lexer = driver->lexer();
int yytoken = -1;
int saved_yytoken = -1;
reallocateStack();
JavaScript::Lexer *lexer = driver->lexer();
bool hadErrors = false;
int yytoken = -1;
int action = 0;
tos = 0;
state_stack[++tos] = INITIAL_STATE;
first_token = last_token = 0;
while (true)
{
const int state = state_stack [tos];
if (yytoken == -1 && - TERMINAL_COUNT != action_index [state])
{
if (saved_yytoken == -1)
{
yytoken = lexer->lex();
location_stack [tos] = location(lexer);
}
else
{
yytoken = saved_yytoken;
saved_yytoken = -1;
}
}
tos = -1;
int act = t_action (state, yytoken);
if (act == ACCEPT_STATE)
return true;
else if (act > 0)
{
if (++tos == stack_size)
do {
if (++tos == stack_size)
reallocateStack();
sym_stack [tos].dval = lexer->dval ();
state_stack [tos] = act;
location_stack [tos] = location(lexer);
yytoken = -1;
state_stack[tos] = action;
_Lcheck_token:
if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
if (first_token == last_token) {
yytoken = lexer->lex();
yylval = lexer->dval();
yylloc = location(lexer);
} else {
yytoken = first_token->token;
yylval = first_token->dval;
yylloc = first_token->loc;
++first_token;
}
}
else if (act < 0)
{
int r = - act - 1;
tos -= rhs [r];
act = state_stack [tos++];
action = t_action(action, yytoken);
if (action > 0) {
if (action != ACCEPT_STATE) {
yytoken = -1;
sym(1).dval = yylval;
loc(1) = yylloc;
} else {
--tos;
return ! hadErrors;
}
} else if (action < 0) {
const int r = -action - 1;
tos -= rhs[r];
switch (r) {
./
......@@ -476,9 +514,8 @@ PrimaryExpression: T_DIVIDE_ ;
case $rule_number: {
bool rx = lexer->scanRegExp(JavaScript::Lexer::NoPrefix);
if (!rx) {
error_message = lexer->errorMessage();
error_lineno = lexer->startLineNo();
error_column = lexer->startColumnNo();
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
lexer->startColumnNo(), lexer->errorMessage()));
return false;
}
sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
......@@ -494,9 +531,8 @@ PrimaryExpression: T_DIVIDE_EQ ;
case $rule_number: {
bool rx = lexer->scanRegExp(JavaScript::Lexer::EqualPrefix);
if (!rx) {
error_message = lexer->errorMessage();
error_lineno = lexer->startLineNo();
error_column = lexer->startColumnNo();
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
lexer->startColumnNo(), lexer->errorMessage()));
return false;
}
sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
......@@ -2032,79 +2068,116 @@ case $rule_number: {
PropertyNameAndValueListOpt: PropertyNameAndValueList ;
/.
} // switch
} // switch
action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT);
} // if
} while (action != 0);
if (first_token == last_token) {
const int errorState = state_stack[tos];
// automatic insertion of `;'
if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
SavedToken &tk = token_buffer[0];
tk.token = yytoken;
tk.dval = yylval;
tk.loc = yylloc;
#if 0
const QString msg = QString::fromUtf8("Missing `;'");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
yylloc.startLine, yylloc.startColumn, msg));
#endif
first_token = &token_buffer[0];
last_token = &token_buffer[1];
state_stack [tos] = nt_action (act, lhs [r] - TERMINAL_COUNT);
yytoken = T_AUTOMATIC_SEMICOLON;
yylval = 0;