Commit 21f0f2c9 authored by hjk's avatar hjk
Browse files

debugger: work on location marker setting.

parent 828b1f96
......@@ -1357,9 +1357,9 @@ void DebuggerManager::resetLocation()
void DebuggerManager::gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker)
{
if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) {
d->m_disassemblerViewAgent.setFrame(frame);
if (setMarker)
resetLocation();
d->m_disassemblerViewAgent.setFrame(frame);
} else {
// Connected to the plugin.
emit gotoLocationRequested(frame.file, frame.line, setMarker);
......
......@@ -2321,6 +2321,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
// we already issued a 'gotoLocation' when reading the *stopped
// message.
const StackFrame &frame = manager()->stackHandler()->currentFrame();
qDebug() << "GOTO, 2nd try" << frame.toString();
gotoLocation(frame, true);
}
} else {
......@@ -2353,8 +2354,8 @@ void GdbEngine::activateFrame(int frameIndex)
StackHandler *stackHandler = manager()->stackHandler();
int oldIndex = stackHandler->currentIndex();
//qDebug() << "ACTIVATE FRAME:" << frameIndex << oldIndex
// << stackHandler->currentIndex();
qDebug() << "ACTIVATE FRAME:" << frameIndex << oldIndex
<< stackHandler->currentIndex();
if (frameIndex == stackHandler->stackSize()) {
reloadFullStack();
......@@ -3875,6 +3876,8 @@ void GdbEngine::fetchDisassemblerByAddress(DisassemblerViewAgent *agent,
QTC_ASSERT(agent, return);
bool ok = true;
quint64 address = agent->address().toULongLong(&ok, 0);
qDebug() << "ADDRESS: " << agent->address() << address;
QTC_ASSERT(ok, return);
quint64 start = address - 20;
quint64 end = address + 100;
// -data-disassemble [ -s start-addr -e end-addr ]
......@@ -4005,6 +4008,7 @@ void GdbEngine::gotoLocation(const StackFrame &frame, bool setMarker)
{
lastFile = frame.file;
lastLine = frame.line;
//qDebug() << "GOTO " << frame.toString() << setMarker;
m_manager->gotoLocation(frame, setMarker);
}
......
......@@ -226,6 +226,7 @@ QByteArray TrkGdbAdapter::trkWriteRegisterMessage(byte reg, uint value)
QByteArray TrkGdbAdapter::trkReadMemoryMessage(uint addr, uint len)
{
QByteArray ba;
ba.reserve(11);
appendByte(&ba, 0x08); // Options, FIXME: why?
appendShort(&ba, len);
appendInt(&ba, addr);
......@@ -237,14 +238,37 @@ QByteArray TrkGdbAdapter::trkReadMemoryMessage(uint addr, uint len)
QByteArray TrkGdbAdapter::trkStepRangeMessage(byte option)
{
QByteArray ba;
ba.reserve(13);
appendByte(&ba, option);
appendInt(&ba, m_snapshot.registers[RegisterPC]); // start address
appendInt(&ba, m_snapshot.registers[RegisterPC]); // end address
appendInt(&ba, m_snapshot.registers[RegisterPC]); // Start address
appendInt(&ba, m_snapshot.registers[RegisterPC]); // End address
appendInt(&ba, m_session.pid);
appendInt(&ba, m_session.tid);
return ba;
}
QByteArray TrkGdbAdapter::trkDeleteProcessMessage()
{
QByteArray ba;
ba.reserve(6);
appendByte(&ba, 0); // ?
appendByte(&ba, 0); // Sub-command: Delete Process
appendInt(&ba, m_session.pid);
return ba;
}
QByteArray TrkGdbAdapter::trkInterruptMessage()
{
QByteArray ba;
ba.reserve(9);
// Stop the thread (2) or the process (1) or the whole system (0).
// We choose 2, as 1 does not seem to work.
appendByte(&ba, 2);
appendInt(&ba, m_session.pid);
appendInt(&ba, m_session.tid); // threadID: 4 bytes Variable number of bytes.
return ba;
}
void TrkGdbAdapter::startInferiorEarly()
{
QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
......@@ -562,12 +586,8 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
else if (cmd == "k" || cmd.startsWith("vKill")) {
// Kill inferior process
logMessage(msgGdbPacket(QLatin1String("kill")));
QByteArray ba;
appendByte(&ba, 0); // ?
appendByte(&ba, 0); // Sub-command: Delete Process
appendInt(&ba, m_session.pid);
sendTrkMessage(0x41, TrkCB(handleDeleteProcess),
ba, "Delete process"); // Delete Item
trkDeleteProcessMessage(), "Delete process");
}
else if (cmd.startsWith("m")) {
......@@ -1380,13 +1400,7 @@ void TrkGdbAdapter::interruptInferior()
{
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
qDebug() << "TRYING TO INTERRUPT INFERIOR";
QByteArray ba;
// stop the thread (2) or the process (1) or the whole system (0)
// We choose 2, as 1 does not seem to work.
appendByte(&ba, 2);
appendInt(&ba, m_session.pid);
appendInt(&ba, m_session.tid); // threadID: 4 bytes Variable number of bytes.
sendTrkMessage(0x1a, TrkCallback(), ba, "Interrupting...");
sendTrkMessage(0x1a, TrkCallback(), trkInterruptMessage(), "Interrupting...");
}
void TrkGdbAdapter::handleGdbError(QProcess::ProcessError error)
......@@ -1718,10 +1732,15 @@ void TrkGdbAdapter::shutdown()
setState(DebuggerNotReady);
return;
case InferiorStopped:
case InferiorStopping:
case InferiorRunningRequested:
case InferiorRunning:
//sendTrkMessage(0x1a, TrkCallback(), trkInterruptMessage(), "Interrupting...");
// Fall through.
case InferiorStopped:
//sendTrkMessage(0x41, TrkCallback(), trkDeleteProcessMessage(), "Delete process");
//sendTrkMessage(0x02, TrkCB(handleDisconnect));
setState(InferiorShuttingDown);
m_engine->postCommand(_("kill"), CB(handleKill));
return;
......
......@@ -167,6 +167,8 @@ public:
QByteArray trkReadMemoryMessage(uint addr, uint len);
QByteArray trkBreakpointMessage(uint addr, uint len, bool armMode = true);
QByteArray trkStepRangeMessage(byte option);
QByteArray trkDeleteProcessMessage();
QByteArray trkInterruptMessage();
void handleAndReportSetBreakpoint(const TrkResult &result);
void handleReadMemoryBuffered(const TrkResult &result);
void handleReadMemoryUnbuffered(const TrkResult &result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment