Fixes: debugger: revert accidental parts of b0650238

This commit is contained in:
hjk
2009-02-11 14:17:25 +01:00
parent 9e2671c9a3
commit df16699ed9
3 changed files with 98 additions and 96 deletions

View File

@@ -68,6 +68,7 @@ int qtGhVersion = QT_VERSION;
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include <windows.h> # include <windows.h>
@@ -2484,6 +2485,7 @@ void qDumpObjectData440(
int extraInt2, int extraInt2,
int extraInt3) int extraInt3)
{ {
//sleep(20);
if (protocolVersion == 1) { if (protocolVersion == 1) {
QDumper d; QDumper d;
d.protocolVersion = protocolVersion; d.protocolVersion = protocolVersion;

View File

@@ -3586,121 +3586,121 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
void GdbEngine::updateLocals() void GdbEngine::updateLocals()
{ {
setTokenBarrier(); setTokenBarrier();
m_pendingRequests = 0; m_pendingRequests = 0;
PENDING_DEBUG("\nRESET PENDING"); PENDING_DEBUG("\nRESET PENDING");
m_toolTipCache.clear(); m_toolTipCache.clear();
m_toolTipExpression.clear(); m_toolTipExpression.clear();
qq->watchHandler()->reinitializeWatchers(); qq->watchHandler()->reinitializeWatchers();
int level = currentFrame(); int level = currentFrame();
// '2' is 'list with type and value' // '2' is 'list with type and value'
QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level); QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level);
sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2 sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2
// '2' is 'list with type and value' // '2' is 'list with type and value'
sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2 sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2
} }
void GdbEngine::handleStackListArguments(const GdbResultRecord &record) void GdbEngine::handleStackListArguments(const GdbResultRecord &record)
{ {
// stage 1/2 // stage 1/2
// Linux: // Linux:
// 12^done,stack-args= // 12^done,stack-args=
// [frame={level="0",args=[ // [frame={level="0",args=[
// {name="argc",type="int",value="1"}, // {name="argc",type="int",value="1"},
// {name="argv",type="char **",value="(char **) 0x7..."}]}] // {name="argv",type="char **",value="(char **) 0x7..."}]}]
// Mac: // Mac:
// 78^done,stack-args= // 78^done,stack-args=
// {frame={level="0",args={ // {frame={level="0",args={
// varobj= // varobj=
// {exp="this",value="0x38a2fab0",name="var21",numchild="3", // {exp="this",value="0x38a2fab0",name="var21",numchild="3",
// type="CurrentDocumentFind * const",typecode="PTR", // type="CurrentDocumentFind * const",typecode="PTR",
// dynamic_type="",in_scope="true",block_start_addr="0x3938e946", // dynamic_type="",in_scope="true",block_start_addr="0x3938e946",
// block_end_addr="0x3938eb2d"}, // block_end_addr="0x3938eb2d"},
// varobj= // varobj=
// {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}", // {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}",
// name="var22",numchild="1",type="const QString ...} }}} // name="var22",numchild="1",type="const QString ...} }}}
// //
// In both cases, iterating over the children of stack-args/frame/args // In both cases, iterating over the children of stack-args/frame/args
// is ok. // is ok.
m_currentFunctionArgs.clear(); m_currentFunctionArgs.clear();
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
const GdbMi list = record.data.findChild("stack-args"); const GdbMi list = record.data.findChild("stack-args");
const GdbMi frame = list.findChild("frame"); const GdbMi frame = list.findChild("frame");
const GdbMi args = frame.findChild("args"); const GdbMi args = frame.findChild("args");
m_currentFunctionArgs = args.children(); m_currentFunctionArgs = args.children();
} else if (record.resultClass == GdbResultError) { } else if (record.resultClass == GdbResultError) {
qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen"; qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen";
} }
} }
void GdbEngine::handleStackListLocals(const GdbResultRecord &record) void GdbEngine::handleStackListLocals(const GdbResultRecord &record)
{ {
// stage 2/2 // stage 2/2
// There could be shadowed variables // There could be shadowed variables
QList<GdbMi> locals = record.data.findChild("locals").children(); QList<GdbMi> locals = record.data.findChild("locals").children();
locals += m_currentFunctionArgs; locals += m_currentFunctionArgs;
setLocals(locals); setLocals(locals);
} }
void GdbEngine::setLocals(const QList<GdbMi> &locals) void GdbEngine::setLocals(const QList<GdbMi> &locals)
{ {
//qDebug() << m_varToType; //qDebug() << m_varToType;
QHash<QString, int> seen; QHash<QString, int> seen;
foreach (const GdbMi &item, locals) { foreach (const GdbMi &item, locals) {
// Local variables of inlined code are reported as // Local variables of inlined code are reported as
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this", // 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..." // numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
// We do not want these at all. Current hypotheses is that those // We do not want these at all. Current hypotheses is that those
// "spurious" locals have _two_ "exp" field. Try to filter them: // "spurious" locals have _two_ "exp" field. Try to filter them:
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
int numExps = 0; int numExps = 0;
foreach (const GdbMi &child, item.children()) foreach (const GdbMi &child, item.children())
numExps += int(child.name() == "exp"); numExps += int(child.name() == "exp");
if (numExps > 1) if (numExps > 1)
continue; continue;
QString name = item.findChild("exp").data(); QString name = item.findChild("exp").data();
#else #else
QString name = item.findChild("name").data(); QString name = item.findChild("name").data();
#endif #endif
int n = seen.value(name); int n = seen.value(name);
if (n) { if (n) {
seen[name] = n + 1; seen[name] = n + 1;
WatchData data; WatchData data;
data.iname = "local." + name + QString::number(n + 1); data.iname = "local." + name + QString::number(n + 1);
data.name = name + QString(" <shadowed %1>").arg(n); data.name = name + QString(" <shadowed %1>").arg(n);
//data.setValue("<shadowed>"); //data.setValue("<shadowed>");
setWatchDataValue(data, item.findChild("value"));
data.setType("<shadowed>");
data.setChildCount(0);
insertData(data);
} else {
seen[name] = 1;
WatchData data;
data.iname = "local." + name;
data.name = name;
data.exp = name;
data.framekey = m_currentFrame + data.name;
setWatchDataType(data, item.findChild("type"));
// set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery
if (isIntOrFloatType(data.type) || isPointerType(data.type))
setWatchDataValue(data, item.findChild("value")); setWatchDataValue(data, item.findChild("value"));
if (!qq->watchHandler()->isExpandedIName(data.iname)) data.setType("<shadowed>");
data.setChildrenUnneeded(); data.setChildCount(0);
if (isPointerType(data.type) || data.name == "this") insertData(data);
data.setChildCount(1); } else {
if (0 && m_varToType.contains(data.framekey)) { seen[name] = 1;
qDebug() << "RE-USING " << m_varToType.value(data.framekey); WatchData data;
data.setType(m_varToType.value(data.framekey)); data.iname = "local." + name;
data.name = name;
data.exp = name;
data.framekey = m_currentFrame + data.name;
setWatchDataType(data, item.findChild("type"));
// set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery
if (isIntOrFloatType(data.type) || isPointerType(data.type))
setWatchDataValue(data, item.findChild("value"));
if (!qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
if (isPointerType(data.type) || data.name == "this")
data.setChildCount(1);
if (0 && m_varToType.contains(data.framekey)) {
qDebug() << "RE-USING " << m_varToType.value(data.framekey);
data.setType(m_varToType.value(data.framekey));
}
insertData(data);
} }
insertData(data);
}
} }
} }

View File

@@ -161,7 +161,7 @@ bool Debugger::Internal::interruptProcess(int pID)
#else #else
int procId = pID; int procId = pID;
if (procId != -1) { if (procId != -1) {
if (kill(procId, 2) == 0) if (kill(procId, SIGINT) == 0)
return true; return true;
} }